This could be a few things, but first I would make sure you charger sits flush with the bottom of your iPhone. If there’s a gap where you can see the metal of the lightning connector, or it connects sort of askew, chances are your lightning port is just full of debris and needs a good cleaning. You can usually get most crud out with a toothpick, just be gentle since the pins inside the port can be damaged.
If all cables are still loose in the port, I would start with [guide|111207|a new charge port assembly.|new_window=true] And check your battery health in your iPhone’s settings. (Under Battery > Battery Health). If it says Service, the battery should likely be replaced (this could also be an issue with both parts, especially if you have had the phone for a while).