Make sure that your device has the latest version of iOS or iPadOS and that your apps are up to date.
Please follow the steps in the following link for support with this issue: If your iOS device restarts or displays the Apple logo or a spinning gear unexpectedly