Although there is much difference in 5E from previous editions, it has not really changed my mind about when to hand out XP or level up. I typically do it when the party is relatively safe, and after what is now called a long rest.
There have been adventures, especially beat the clock type OR...