Find the way to get the customer record for an entity.
Example: I want to get the contact - customer lookup this can be account or contact else blank.
Step 1 : Get the contact record by contact id and select "_parentcustomerid_value" to return at least, can be ignored that will give full list of fields
Step 2 : Run the flow take the output of the flow action from above step and copy body on to Parse Json.
content use out put from get contact details - body & generate sample.

Step 3: Important step to identify customer lookup logical name - Compose date oprator user - body('Parse_JSON')?['_parentcustomerid_value@Microsoft.Dynamics.CRM.lookuplogicalname that returns lookup logical name in case if you want get the out put as null use coalesce it returns value if blank coalesce(body('Parse_JSON')?['_parentcustomerid_value@Microsoft.Dynamics.CRM.lookuplogicalname'],'none')

Step 4: Use switch statement and use output of the compose to branch the contact or account else default to get the record values
Step 5: Get contact or account details

If you find useful please thumbs up.