So that you won't wake up to pee and then have trouble falling back asleep. (If youāre a dude, consider using a pee bottle to minimize necessary alertness.)
If you do feel the urge to go, experiment with not. It may seem counterintuitive because you might think it's better to empty your bladder to be able to sleep through the night without further interruption, but I personally have found that my digestive system essentially hibernates during the night/when I'm sleeping and there's almost a "breaking the seal" phenomenon where if I pee once during the night, I'm more likely to pee more than once. (Though it's also the case that if I spend a long period of time awake in the night, I'm much more likely to need to pee ā where I'm assuming my digestive system is essentially also "awake." So it could be that my data is being affected by that first wakeup affecting how deeply and quickly I get back to sleep).
If youāre worried about holding it too long: I recently read that you should be spending about 20 seconds per pee (obviously that canāt really be a proper āshould,ā but I never had any point of reference before, so seems good to add).