One thing that helps me to focus on the task at hand is using Promodoro timers: 25 minutes focussed work, then 5 minutes break.
More generally, if distractions are bothering you or are making you nervous, I would recommend meditation. Meditation is the practice of focussing on the present. Try the waking up app (https://wakingup.com/), it is a good reason-based introduction to the practice and theory of meditation.