Medications (I take Focalin)
When in offices I can't stand to have anyone who can see my screen, I feel intense anxiety/pressure to appear like I'm doing something on the computer. So when I worked in an open plan I tried to sit with my back to the wall in a low traffic corner, or would often take my laptop to a conference room or lounge seat. At one job I had a cubicle in a corner where I could see the entire room, but others couldn't see my screens. My productivity dropped when I had to change to a higher floor... my new desk had a nice view outside, but anyone walking by could see my screens!
When working from home, I use a separate room for my office, and try to only associate it with work and other "productive" activities. Ideally with a door I can close. It helps a little bit. (Burnt out so I got laid off and am no longer working)
On my computer I try to close tabs and apps at the end of the day, if I won't need them tomorrow. And I try to spend a minute or two tidying my desk/office every day.
I try to use screen time (to reduce how much I use reddit and such). I don't use the various focus modes on iPhone/Mac very effectively, but they can help so you only get certain notifications or access certain apps depending on where you are/whether you're working or not/etc.
Noise cancelling headphones help in offices, at home, and in public places where I don't need to interact with others much. I use AirPods Max when I'm working and AirPods Pro when I'm out on errands, highly recommend if you use Apple devices. They both have a transparency mode you can toggle which allows you to hear sounds from outside only when you want to. You don't have to be playing music to use the noise canceling feature... but listening to the right kind of music can help focus better on tasks. there are also great noise canceling options from companies like Sony and Bose.