So, the first thing you need to do is to figure out if the problem is in your phone or in the charger. Try either charging your phone with another charger or using your charger to charge someone else's phone.
If the charger is the problem, it's most likely broken inside and you need to get a new one. Tape might do the trick for a short time.
If the phone is the problem, try cleaning out the charging port. I personally use bamboo cocktail sticks that I crush with pliers to make them have small rough bristles. Lots of objects work for this (pretty much anything thin, preferably brush-like), just as long as you don't put anything wet there.
It's just easier and simpler. If it ain't broke, don't fix it. Besides, I don't want to dig my phone, open it, and have to turn off a 1900 'legitimate interest' switches or get told to download an app and let them install a camera in my ass.
If the knife is long enough, you could simply line the apples up and do that.