Context switching has more overhead cost than we usually estimate. I've found that focusing on a single activity (assuming that activity requires considerable mental effort - maths/CS etc) in a day, and then gradually increasing that count to 2-3 activities over weeks/months while carefully measuring the context switch cost, has been consistently effective for me.
Instead of fighting distractions and draining your mental energy, use simple tricks tips to block them out, such as - switching your phone off putting it in a separate room, or blocking websites etc - the idea is to create enough friction/blockage to make it difficult to indulge or even get started with them.
During the breaks from your work, every once in a while try to push yourself to seek boredom - this does 2 things - first, you're building your will power against those quick dopamine hits of info/media we keep craving for, and secondly depriving your brain of any kind of interesting stimulus or any mentally stimulating task makes your brain better at seeking those through your work, because your brain is not getting it from elsewhere. On other occasions, you can put that time for your hobbies, too. Generally, you should try seeking for activities that require longer attention span and are fun.