After reading this support article:--> If your iPhone or iPad gets too hot or too cold, check you battery status by going to Settings>Battery>Battery Health>Maximum Capacity and tap there.
What percentage can you see? If it is close to 85-80% (bearing in mind that that value is related to when your battery, not your iPhone, was new), and this means that it is reaching the critical point of its life, and might have unpredictable behavior.
Should be this case, create a full backup of your device on a regular basis (before the battery dies), and make an appointment (*) and have your battery replaced at an Apple Store or AASP (Apple Authorized Service Provider) among this list:--> Apple – Location Selector.
Shouldn't be this case, for your peace of mind, have your device inspected. After checking it out, Apple technicians will give you all the available options.
Regards
Giulio
(*) You can do it: