First try a Forced restart
Force restart iPhone – Apple Support (UK)
If no better
Backup, restore to factory, and restore from backup
If you can import your media to Photos or iTunes in a computer and copy important documents to a cloud server it will give you some resilience in case the restore from backup fails.
(1) How to back up your iPhone, iPad, and iPod touch - Apple Support
(2) Restore your iPhone, iPad, or iPod to factory settings - Apple Support
(3) Restore your iPhone, iPad, or iPod touch from a backup - Apple Support
If the problem remains then do step (2) again but set up as new without restoring any backup. If that fixes it then it is probably a rogue app.
Otherwise arrange a repair
iPhone Repair - Official Apple Support
You will need to do (1) and (2) anyway if you need a repair or new phone.