Welcome to Android Central! Try booting into Safe Mode, which temporarily disables all 3rd party apps.
https://support.t-mobile.com/docs/DOC-10696. (The process should be the same as for the S5.)
If the problem disappears in Safe Mode, then something you installed is causing the problem. You may have to uninstall apps one by one until the problem disappears. If the problem persists in Safe Mode, then it's more likely to be a hardware or firmware problem.