It'll always "work" in the sense that any RPG can be reskinned for any genre. It's a question of whether it works as well as an RPG designed specifically for that genre. No other game could capture the exact nature of "D&D" as well as D&D can, for example.
Capturing the exact game and capturing the genre that game was aiming at are two very different things - especially with D&D.
And, actually, you can not just capture any given genre in universal systems, you can even capture the system artifacts that some other game has inflicted on that genre (if you want to, for some reason).
D&D for a fantasy setting in which magic is in no way use/day limited, for instance, is dead in the water. Fantasy Hero, say, works fine with that assumption. But, if you want to, you can slap charges limitation on all mages in your Fantasy Hero campaign, instead. In D&D armor makes you harder to hit, in RuneQuest, harder to hurt, in GURPS /both/ - in Hero, either or both or, I suppose, if you really wanted, neither.
But, the reasons that come up in threads like these that D&D couldn't possibly handle some other genre - the bizarre taboo horror of firearms in D&D, mainly - not always valid. D&D does limit itself, heavily, with it's reliance on magic to make it's challenge dynamics viable, but that's really the major stumbling block. Hit Points can be quite a flexible mechanic, for instance.