It may well need looking at in an Apple store. You will have to back it up if it goes into Apple repair shop so why not try a back up and restore in iTunes first and see if it fixes it.
Restoring via iTunes will repair the iOS software on your iPhone.
How to back up your iPhone, iPad, and iPod touch - Apple Support
After backing up, restore via iTunes to repair the iOS software. You should test by setting it up as “new” after restoring:
Restore your iPhone, iPad, or iPod to factory settings - Apple Support
If it seems to work OK after setting up as a new iPhone, restore your backup and test again:
Restore your iPhone, iPad, or iPod touch from a backup - Apple Support