Between sessions as much as is possible. We take a little time out to roll hit points but then I leave it up to the players to do the work, modify the character sheet, at home before the next session.
I rarely even bother to look at XP until an adventure is over or there is a sufficient break within a larger adventure where it might make sense. I've given out XP nine times in my current local game and we've had 40 sessions. The party is 7th level.
I handle it with a few days of downtime while the party is in a safe area with reasonable facilities for training and resting. In practice, this usually means in town as the party returns from a mission.
I typically do not award XP for individual encounters, but for completing quests. But if I have a dungeon guarding the princess they need to save, the total XP award will still be based on the opposition guarding the princess.