The XP system as it exists now is a useful way to populate a dungeon or an adventuring day with monsters. However, because of the variance of luck, terrain, and tactical skill of the players or the monsters, the actual challenge that a party faces may be different from the projected "encounter difficulty" based on XP threshold in the DMG.
If you're looking for a way to more appropriately reward XP based on actual challenge level, you can determine the actual XP reward for an encounter after the encounter is over, based on the actual challenge the party faced.
- Reward XP as if the party defeated an Easy encounter if the party didn't need to use healing or daily abilities in the encounter in order to succeed.
- Reward XP as if the party defeated a Medium encounter if the party had to spend healing or daily abilities in the encounter, but no characters dropped unconscious for more than a round.
- Reward XP as if the party defeated a Hard encounter if the party had at least one party member taken out of the fight entirely.
- Reward XP as if the party defeated a Deadly encounter if the at least half of the party was taken out of the fight entirely.