How to create a case in pega post the user is submitting a form on a different application i.e outside pega

How a case in pega will be created post the user is submitting a form on a different application i.e outside pega-will dx api work here?or do we need to invoke a connect rest?

Yes, DX API is actually the preferred approach if the external application is responsible for collecting the form data and you want that application to directly create and process a Pega case(external application can directly submit the form data to POST /api/application/v2/cases). The DX API is specifically designed to allow external UIs (React, Angular, custom web apps, portals, mobile apps etc) to create and orchestrate Pega cases through REST endpoints. There could be other appoaches also feasible here for exa: External App > Pega Service REST > Create Case