Chosen Solution

Any time I plug in headphones to listen to music the audio cuts in and out and sounds scratchy. The phone speaker works completely fine when I play music directly through it. I also know the headphones work fine, I’ve plugged them into my computer and they sound fine.

Since the speakers work fine, and the headphones themselves work fine, the problem is probably your headphone jack. Follow the steps in this guide to replace it.