Back in the early days of smartphone technology it wasn't unusual for these devices ti get bogged down by gummy apps that would force them to freeze. If you were lucky you could just turn it off and back on, make sure you quit out of whatever was causing the problem, and everything would be good as new.
These days a frozen iPhone is much less common, which means people are less likely to know how to handle the situation if they encounter it. Fortunately, some folks are still researching all the different ways to restart your iPhone is it freezes:
...Hold these buttons down simultaneously for 10 seconds or longer. Those with an iPhone 7 or later will have to perform the hard reset by holding the volume down button and side button.
When the Apple logo comes up on the screen, you can let go of the buttons.
The phone will start and everything should go back to working properly. If it does start working, you should try to look into what caused it to freeze in the first place.
You can read the rest of that article right here.