Why does this happen?

Where you’re trying to sleep and you start thinking about going to pee or you have to use the restroom when you really don’t and can’t no longer sleep because of that this just started happening to me and I hate it because I’ll try to go back to sleep and I can’t