Try booting your phone into 'safe mode'. This will load only the OS and not any 3rd party apps that may start up on boot.
If it works normally in safe mode there may be an app which is preventing you from using the touchscreen. You will then have to find out which app is giving you the problem.
This will be a long process, depending on how many apps you have. In safe mode, back up your phone using the backup feature. Then uninstall either one app at a time or a group of apps (ones that you have installed not ones that were already there) then try starting the phone normally to see if it works. If it still doesn't work you will have to go back into safe mode to uninstall some more until you find the one. Make a list of the ones you uninstalled. When you find the one that was causing the problem, you can restore your phone using the backup that you made. This will however reinstall the app causing the problem. Go into safe mode to uninstall it then hopefully you should be fixed and up to date. (You may wish to do the above with the charger connected. Saves any bother of the battery dying when you are doing things).
If it fails in safe mode, you could try a hard reset to see if this restores full function to your phone.
Here is a link which describes various options on how to start in safe mode:
Here is how to hard reset your phone.
Be aware that a hard reset will erase all your downloaded apps and user data and will restore your phone to a default factory condition. It will be like when you first bought it
Before you perform a hard reset ensure that the battery is fully charged. Do not perform a hard reset with the charger connected.
1. Turn the Galaxy S5 off.
2. Press and hold the Volume up button, the Home button, and the Power button together until you see the Android on screen, then release the buttons
3. Use Volume down to highlight the wipe data/factory reset option and press the Power button to select it.
4. Use Volume down again to highlight ''Yes – delete all user data and press Power to select it.
5. Wait until you see the reboot system now option and then use the Power button to select it.
When the S5 restarts it should be completely wiped and ready to set up again.
Be patient it takes a few minutes