Try to set screentime limits and use apps that limit your usage. I use Screenzen, which pops up before I open certain apps asking "is this important" which gives me a 5s to think if I actually want to use it or just scroll. It also sets limits for apps which is useful.
If you get sucked into apps like Tiktok, IG Reels, YT shorts etc, an app called NoScroll blocks them after a time so whenever you try to go on reels for example, it takes you back to the homepage and you physically cannot watch reel videos. It allows you to still use the rest of IG and YouTube but it might break tiktok since the main thing is watching videos.
If you just want to focus when it's time to revise, try setting modes in your settings. I have a Samsung but I'm pretty sure iphones have a similar feature where you can create a 'study' mode and when it's on, you can choose certain apps that it blocks until you turn it off again. Turn off your notifications when it's time to revise and consider apps like forest or flora that block you from going onto other apps while you're studying.
At the end of the day, these apps can only do so much and it does come down to you to put your foot down. If it gets to the point where you are seriously on there for hours, it might be time to delete them.