1. try to leave the phone switched off like 10 minutes then turn on
2. install avast antivirus and scan if there is some.
3. clean junk files which lags and heatup the phone via clean master, use cpu cooler to cool up, search within the clean master for power hungry apps and put them to sleep or hybernate so they stop consuming a lot of battery or ram and see if the problem is gone.
4. if not then delete the app causing heat and using lot of resources ram and battery.
5. if problem still exists format your phone (hard reset).
6. if not then it is a hardware problem return the phone if guarantee is valid