If your iPhone freezes or becomes unresponsive you can restart it by holding the sleep button until the red slider appears and then slide your finger across it to switch off the phone.
Then to switch it back on hold the sleep/wake button until the Apple logo appears.
However, if this doesn’t work you can reset the iPhone settings by going to the home screen and then Settings > General > Reset > Reset All Settings. This will reset all of your preferences without deleting any media on your phone.