That suggests a serious fault in the hardware, but there are things you can do before arranging a repair.
First thing I advise is to try a Forced restart
Force restart iPhone – Apple Support (UK)
If no better you could Backup, restore to factory, maybe set up without restoring backup and test at that point,, then erase again and restore from the backup:-
(If the phone needs attention you will have to do this anyway)
See here for the resources you need. Allow a couple of hours:
How to back up your iPhone, iPad, and iPod touch - Apple Support
Restore your iPhone, iPad, or iPod to factory settings - Apple Support
Restore your iPhone, iPad, or iPod touch from a backup - Apple Support
Otherwise arrange a repair
Click here > https://support.apple.com/iphone/repair/service
Or
Click here > Contact - Official Apple Support
Anything other than Screen or Battery may be a replacement phone and the price is in the article under "Other damage"
See also: Get your iPhone, iPad, or iPod touch ready for service - Apple Support