Generally speaking it's way more often the app that is having an issue. If you realize that the device is super hot or something though then it can be something else causing an issue, especially if what you have open in task manager is just a single app like messenger, which normally wouldn't cause so much heat.