The best way to start is by rebooting your device. Press and hold the sleep/wake button, and when you see the slider, drag it, and restart your device.
Another solution which is simple as well is to clean the charging port, which often can be full of dirt and dust. Do this carefully, with the small needed or a toothpick.
If you wanted to charge your iPhone via USB cable, try the wall charger, and the other way around. For reasons such as a faulty wall charger, for example, one method won’t work, but the other one will.
If the iOS is not up to date, you can expect many issues. However, once you download and install the new version, all those issues will be fixed, which includes the charging problem.
Back up the files. Navigate to Settings > General > Reset > Erase all Content and Settings. After several minutes, or even an hour, the process will be successfully finished. In order to set up your iPhone 5s as a new device, just follow the steps on the screen.