If the iOS version is the latest try a forced restart.
Press and quickly release the Volume Up button. Press and quickly release the Volume Down button. Then, press and hold the Side button until you see the Apple logo.
You could do a restore via iTunes and if you still have problems make an appointment at the Genius Bar or at an authorized service provider to have the phone evaluated.