Leechblock on Firefox is pretty good for websites. Essentially, you set up an amount of time you're allowed to view a website and timespan for the rule to be active. Lots of possibilities to customize. There's also one sec or screenzen I think they're called? They're apps that don't block the apps fully, but that make you wait before the app actually opens. Theres studies that show that if you wait for a few seconds before opening the app you're more likely to just give it up and go to bed instead of mindlessly scrolling.
Bonus video explaining the mechanism behind this problem: https://youtu.be/bNOol5OTasw