2 things. Get a good site blocker that can't be removed (I recommend cold turkey). Block every slacking site, even educational ones like youtube, for a certain time block and slowly increase it.
Next try to deconstruct why you're not doing work. Often it's a feeling of shame, so learn to forgive yourself, or an overwhelming feeling, break the task down than. If it's adhd you should look into the methods they use to start tasks
Again if it's ADHD I'd look into starting medication or taking an off the counter stimulant, coffee, to start building those good habits and then weening off.
Finally what helped me if repeating that starting an assignment or going without social media wont kill me