Try different cable, different plug.
Then you're looking at possible battery, charging port.
After that, it'll be board level repair.
You can scrape out debris in your port, be surprised howuch rubbish gets in there, and compacts everytime you plug the lead in, and you'll eventually just get to that point where there's just enough to cause what you're getting now.
Cocktail stick, or sewing needle with phone off is sufficient to clean out.