first though is to clean out the charging port space. dust/lint/dirt/gunk can build up and make the plug not sit all the way in. use a small plastic pick or wooden toothpick to gently see if there's anything to dislodge.
second though is the metal clips on the side (if you look closely on a lightning plug, you'll see indentations on the side which connect to spring loaded clips to hold it in place. over time, and depending on how roughly or gently you disconnect your cable, those clips could lose their springiness and not hold the plug as securely.
third though is the electronics of the charging port, know as the lightning port flex cable assembly. they can go bad too.
the first is an easy DIY. the second and third will require replacing the lightning port flex cable assembly. if you're experienced at phone repair, this is an easy DIY. if not, and you've cleaned out the port, then you might want to take it to a pro shop
crwdns2934105:0crwdne2934105:0
crwdns2934113:0crwdne2934113:0
crwdns2915270:0crwdne2915270:0
crwdns2889612:0crwdne2889612:0
0