So for world events you get XP relative to your level and if there are some 5% more xp for unknown players being nearby.
For quests secondary or story, same thing, it's relative to your level and you get full XP and rewards for doing it for the first time, and less for redoing it. And 10% for being with friends.
For dungeons, the level do not scale. So if a level 50 takes you in a dungeon while you are level 1, and you stay at the entrance while he clears it, you'll get XP for clearing a level 50 dungeon.