Yusufn ~ Restarting randomly can be a symptom of a battery in need of replacement:
"...The power management system determines the capability of the battery to supply this power, and manages the loads in order to maintain operations. When the operations can no longer be supported with the full capabilities of the power management system, the system will perform a shutdown to preserve these electronic components. While this shutdown is intentional from the device perspective, it may be unexpected by the user." [Source: Apple]
…So, if the battery of your iPhone is the original one, it quite likely needs replacement. What's the Maximum Capacity % here?...
Settings > Battery > Battery Health
iPhone Battery & Power Repair
About genuine iPhone batteries
(Articles found by searching Apple's Knowledge Base.)
õ¿õ¬