If it’s an rpg with an amazing world with rich characters and a world just waiting to be explored. You level up so that you can become stronger and finally overcome the obstacle that didn’t make you access that part of the game world.
FPSs normally are over before you’re done with them but again it depends on the narration and the replayability of those levels. Dishonored/Prey/Deus Ex offers a wonderful diversity of options and paths while offering a good chunk of action gameplay.
The one disadvantage that rpgs have is senseless grinding that forces you keep playing the same section or kill the same enemies over and over until you can properly level up or sell their loot for better equipment. The mining sections in Mass Effect 2 were the biggest blemishes on an otherwise perfect game.
An open world always seems more appealing than a linear corridor but the manner of story telling placed into that game world plays a huge part in investing time into exploration.
But you can also blast away at baddies over and over again in a six hour linear corridor shooter with the same gleeful abandon you would get by stomping over roaches(I know). That would make for a lot of repetition but you could come back months later and say “Oh yeah, this is still fun!”