So for the most part, I award xp for overcoming dangerous challenges, and reward other stuff with inspiration. I give xp for overcoming monsters by the book- xp value of monsters divided by number of pcs.
For traps or hazards, I evaluate it as if it were a monster, usually checking its offensive value only. For instance, if it is a single target trap that attacks at +5 to hit and deals 4d10 damage to one target target, that's 22 average damage, so 7 per round. I treat the defensive CR as equal to the offensive CR.
In this case, I award xp as soon as there's enough in the 'bank' for any pc to level. Also, I run mixed level groups, so this can mean I award xp every combat (or hazard) if someone is close to leveling.
I also have one game I am running that uses an entirely different system, which I call "ale and whores". Basically, you only get xp for throwing your money away (thus the name of the system). Not for spending it on gear, bribes, etc; only for spending it ways that give you nothing, no advantage from making friends, nothing. This system can encourage things like pcs hocking their gear for those few extra gps needed to gain a level, or stealing part of the treasure they find from the rest of the party. These aren't bugs, they're features. "Ale and whores" xp is supposed to encourage a specific playstyle, but what has actually happened is that the party has been scrupulous about not dividing treasure until there is enough for everyone to level. In this case, I award xp as soon as the money is spent uselessly.
I have two more systems that I used previously (in 3e) and have considered as options in 5e, but like I said, inspiration kind of takes their place. In both cases, you still get xp for overcoming challenges, but only half the normal amount. Since I haven't used them in 5e, I am not sure when I would award xp with them exactly, but traditionally, it was at the end of each session.
The first of these variants is the "Four Categories of Roleplaying" system. At the end of each session, in addition to monster/challenge xp, each player can earn xp for roleplaying each of four categories: their class, race, alignment, and personal concerns. I play in a game where the DM uses this system, but you can choose your ideal, bond, and flaw as categories too, with a maximum of four. You can't call simply using your abilities as roleplaying, but other than that, the requirements to gain xp for the categories are very loose; the idea is that everyone always gets those as long as they do a little minimal roleplaying. For example, if you are a LG human paladin, you might get alignment xp for sparing a foe; paladin xp for preaching the virtues of your god or oath; race xp for associating with other humans; and personal xp for visiting the grave of a fallen companion. I tailored the amount of xp gained by your level such that if all you did was roleplay, never dealing with any dangerous challenges or monsters, and you earned all four categories of xp each session, you would level up after 10 sessions.
The second variant is the "Ten Traits" system. Each pc can choose ten character/personality traits, and can add one per level above first if they choose. These can be literally anything. I like to wear blue. I hate spiders. I am scared of big dogs. I speak in a loud voice. I prefer spicy food. Etc. At the end of each session, each player points to how they played up to ten of these traits, earning xp for each. Again, it was tailored so that you would level up after 10 sessions given only "ten traits" xp each game. In this case, I expected a slightly lower rate of pcs getting these xp- I thought ten traits would be hard to hit every time if we had a high combat session- but I found that almost every pc got 10 almost every session.