For me, the following has helped:
* Turn off all notifications, that means on all devices.
* Leave your phone in silent mode, better yet hide the screen from your view so you don't see incoming notifications
* Log out of any social media, for me having to log in and do 2FA again is usually the barrier where I remember why I was logged out in the first place
* People have said it but set your dock on auto-hide, you can also turn off the red dots on most applications
* Tons of apps now allow you to go full screen, some writing apps are super minimal, so you really only see text.
* I use a pomodoro timer if I need real focus, there's videos on YouTube that will also just run 45 mins then have 15 minute break, though that might be too distracting an environment initially.