High-end devices like your Apple iPhone that keeps restarting may have some issues with its firmware. It could also be a sign of a hardware issue but there’s only so much you can do about it if that’s really the case. What you can do is rule out the possibility that it’s just a firmware
Random crashes and reboots (boot loops) are usually attributed to memory problems like when the internal memory of the phone is shrinking. They often occur among other performance issues such as lags and freezes that usually transpire as wear-and-tear symptoms in early devices. However, there are some factors that can trigger the same symptoms to
Random restarts often occur when a device gets old or running low on storage. It can also be triggered by some malwares and system bugs. If the underlying cause isn’t that too complex, then the transpiring symptoms will just be minor and therefore easily remedied by standard procedures. Otherwise, more advanced solutions would be necessary.