Hi, Ian Vin.
Thank you for visiting Apple Support Communities.
I would make sure you are using an Apple branded Lightning cable and charger with your iPhone 5. If you are, the troubleshooting steps in the article below may help.
If the issue persists, see the section labeled Issue not resolved.
Try checking your cable socket/lightning cable for dirt, grime, pocket lint, etc. I could not find the solution to this issue myself and after much searching I found someone stating that cleaning this out helped them immensely.
After taking a wooden toothpick (making sure the phone was OFF first) and gently clearing out the edges and inside of the lightning socket this went away.) It is worth noting that I had a significant amount of dust or lint buildup along the edge rails which I think was causing the iphone to believe it was plugged into something when it was not.
Try it and see, ensure you are very careful and do not use any conductive tools to clean the area in question. Compressed air also does wonders here.