That happened to me earlier in the year, thankfully my friend is really good at problem solving stuff related to electronics, so he helped me figure out what to do. I saw a thing online about scraping out the charger port with a toothpick. That might work, but what I did to get mine to charge normally again is the following:
Use Isopropyl Alcohol
If you discover stuck-on grime, very lightly dampen (do not soak) a 90%+ isopropyl alcohol foam swab and gently touch only the outer walls of the port. Avoid rubbing the internal pins directly. Immediately follow with short bursts of compressed air to evaporate any residual liquid. Liquids are very risky, so try dry methods first.
Hope that helps. I went inside the port a bit as well with the cotton swab thing, and also used it on the charger end too. Didn’t do the compressed air thing, but I did wait a bit before turning it back on. Definitely make sure to turn the phone off before doing the swab stuff, but that probably goes without saying lol. Hope it helps!
Last time you ate a taco?