I have ADHD, so I've done this a lot. :)
First take a look at this from a few days ago: https://news.ycombinator.com/item?id=12734671 on a book: Deep Work. Basically just some of the tactics ADHD people have been using for ages.
The whole world seems to have developed some mild sub clinical ADD thanks to social and phones. So first off don't be surprised you're struggling.
Understand that web browsing and social are variable reward machines. Click a link and you have another new snippet to read, or video to see. Each one gives you a reward and a small dopamine boost. Now compare with preparing for interview, or thinking about a side project. Where's the rewards? Later. Maybe not even today! It's a luxury cheesecake vs diet fruit portion question.
Look at the pomodoro technique and break tasks up with small rewards. 25 mins productive, 5 mins social (if you can stop at the next beep). Get a cheap $5 kitchen timer to sit next to you. If your willpower is lacking, add a browser extension to set limits on social cheesecake sites. If the phone is main distraction add an app to silence notifications, or remove the strongest distractions - the social ones!
Same goes for desktop on your laptop - remove the candy, set it up for productivity. Maybe separate logins - one for productivity, one that permits you near the fun stuff. :p
For god's sake don't keep todo lists and such on your phone. Turn phone off, use a notebook, post it or pad, or text file on the laptop! Otherwise you're now holding the crack, and hoping not to be tempted. Just 5 minutes, I can handle it...
Accept that your attention will wander, and get used to checking in and trying to bring it back. That timer helps. If you struggle add another timer to beep every few minutes - as a checkin. Don't get depressed if you trip up. Forgive yourself, and try again - you're building a new habit, and that will take time and many mistakes.
Last, lots of exercise, fluids, healthy eating and breaks away from keyboard will keep you fresh.