Charging issues after a couple of years are usually due to lint accumulation in the phone opening. A little careful time with a toothpick will usually get it sorted.
It isn't just that. It physically wears out as well.
My first gen iPad Pro and iPhone 6s Plus say otherwise.
One pin on the cable (male part) becomes oxidized (black) after time. One can rub the black stuff away using a regular rubber and it usually works again.
I've used contact cleaner and toothpicks to solve this problem before. It only works so many times, eventually it's just totally shot. I've never had a cable fray but I've had 3 or 4 lightning connectors become useless.