Try this basic troubleshooting step: Make a full backup of your device, and reset it to factory settings, setting it up as new. This operation wil install a fresh copy of the latest iOS version, following the instructions provided in this support guide:
Restore your iPhone, iPad, or iPod to factory settings - Apple Support
When done setting it up as a new device, test it for some hours. If everything is working fine, (no overheating. no battery draining), restore your iPhone from your previuosly made backup.
Regards
Giulio