First, try a forced restart. If that doesn't work take it in to the Apple store to have it looked at.
• Press and quickly release the volume up button
• Press and quickly release the volume down button
• Press and hold the side button.
• When the Apple logo appears, release the button.
Force restart iPhone - Apple Support (IN) Force restart iPhone - Apple Support (IN)
Make an appointment at the Genius Bar to have it diagnosed.
Genius Bar Reservation and Apple Support Options - Apple Genius Bar Reservation and Apple Support Options - Apple