Phones stop charging when the battery is too hot to protect it.
1. Remove the case and move the phone to a cool place, out of the sun.
2. Close games and heavy apps while charging.
3. Turn off hotspot.
4. Don't put it in a fridge.
5. Charging continues once the phone cools down.
If it says it is too hot when it isn't warm at all, the temperature sensor, battery or charging circuit may be faulty. Bring it to a technician.