I either take notifications off those apps (only keep the essential ones like texts and calls), or I delete them from my phone, so I would only access them through a computer (Instagram, Facebook, Twitter)
By doing other stuff to distract your mind like cleaning your room and anything. Also checking your wardrobe if you need those or not
I break the habit of continually checking apps for new posts/messages by checking them early at evening and at night I switch my phone to airplane mode so the posts or messages can’t come before sleeping.
I have much self-control. And sometimes I take the help of fear of not accomplishing any task if I continue to spend time on apps. I am an engineering student.