I am also facing the same issue on my iphone xs after updating to ios 16.5. Whenever i plugin my iPhone charger or earphones charger to the port, it gets switched off and as soon as i remove the charger from port, the apple logo appears(Phone Restart happens). Currently i am playing some music behind and charging my mobile. Batter health is degraded <80%.
Any suggestions or fix are appreciated.