I've found just using ScreenTime on macOS during the time where I need to get stuff done is very useful. It is a bit hidden, because you have to enable "Limit Adult Websites", but then you can configure sites you want to block. My list is:
ycombinator.com
guardian.co.uk
theguardian.com
nytimes.com
spiegel.de
Works wonders! It really helps for these little breaks where you automatically go to a site subconsciously. And none of these sites are useful for what I do, except HN sometimes to look up information and pointers about technical topics.