Then it is not a problem on your behalf
It's on your phone's
So double check inside the usb port itself
Turn off your phone
Put a little bit of water into the port
Use any kind of brushes or even your teeth brush to clean it out
Let it dry for a minute
You can also try charging while the phone is off first just to make sure 100% it is not a software related issue
Kindly make sure that the phone is updated to the last software update, you should use the original charger. If the issue still exists you should check the device and the charger in one of the service centers.
I have the same problem. When i plugged in my s23 ultra with original 45 w charger sometimes after couple of minute without touching cable the charging stops and start .
I'm so worried about that. Please help me