I had the same issue, with my first phone and then second with the replacement…I have had lightening port issues on my iPhone 14 Pro Max. I have tried using different cables and even taken off the case to see if that was causing the issue when charging, but no luck. Finally gave up and made a genius appointment for tmw.
I ended up asking for another replacement and the problem is gone so it must be a batch of phones with this defect