iPhone X,XR,XS/Max ( Requires Premium/oem Charging Port replacement) and iPhone 11 and up usually same plus the power flex needs to be replaced. I’ve repaired devices with this issue. Goto settings/privacy/apps and analytic data/analytic data once your in look for panic crash and thermal monitorhd then click look for error missing sensor PR0 or Mic1. If it says either then the above answer is the solution.