As a bonus, I would recommend bullet journaling to keep track of small tasks that might distract you while focusing (“have to pick up eggs on my way phone” type stuff)
Similar to how it is crucial to having a good setting for meditation, for sleep, for exercise… etc.
The other things is that I think it takes practice.
So when I do find I am “in the zone”, I really try to maximize the focused work session and accomplish the tasks required to conpletion.
That doesn’tran work for 3 hours straight and not take a break but it kind of like running or exercising… if I am doing well… I try to go a little farther and push myself.
And the. I also try not to beat myself up too much if I have a less productive focused work session.
You still have to try again- you can’t quit. But just realize you will have another focused work session when you can try again to really focus, work longer and complete the tasks required and not get distracted.
But like a lot of my answers, this is a a work in progress for me as well.