Why not keep an old fashioned notebook next to your bed. If you can’t fall asleep and you have some interesting ideas, jot them down in your notebook. Then the next day you can look and see if those ideas are still worth following up on or not. You can still research or follow up on whatever you want, just don’t do it at 3 am if that’s when you should sleep. When you’re tired and should be asleep you’re probably not going to be doing your best research, instead you’re more likely to start reading some article on a subject you’re not really interested in, and then click on some other unrelated thing that looks interesting, until you’re off on some tangent you don’t even care about and lose 3 hours of sleep to mindless scrolling.
Ultimately all of these kind of “self discipline” things come down to making some rules for yourself to follow, whether it’s only eating one bowl of ice cream instead of the whole carton, or going to one party instead of partying every night, or working out on a regular schedule instead of saying “I don’t feel that motivated, I think I’ll skip the gym.”
There was an article I liked posted online called something like Screw Motivation, you need discipline. Screw motivation, what you need is discipline. – WISDOMINATION.
Maybe read old-fashioned books or something instead of the phone if you really can’t sleep, or try melatonin or something. Like anything else you have to “decide that you really want to” (stop drinking, stop smoking, work out, stick to a diet…) There’s really no app that can do it for you.
Also start small and work up to bigger things. If you still want to play with the phone before bed, allow yourself to do that, but only for 20 minutes. Or only on Monday and Wednesday. Pick something doable that’s a modest improvement over what you actually do now, and then once you’re on top of that, improve from there. Take it one day at a time.