Touchscreen doesn't work but the screen is still visible
Even if you can no longer use the touchscreen, you can still access data, such as pictures or messages, using a USB mouse.
For newer models, you can use the USB connector that came with your phone to connect a mouse. For other phone models, you can purchase a multi-port adapter.
Connect the adapter to your phone, and then connect the mouse's USB to the adapter. You can also connect a keyboard the same way, so you are able to enter your PIN or Password.
Now that you're connected, you can click your way through backing up your data.