I am in the middle of thinking about crafting a megadungeon for OD&D, and the idea of a more dynamic place came to mind. I'm trying to walk a line between overly boring and confining realism and the completely gonzo nonsense that a lot of old modules seem to show to an extent. This got me thinking about spellcasting and how mundanely it is handled in a lot of games.
Think about it like this: you have a party of PCs in a dungeon. This dungeon began as a human crypt, expanded over time as it happens in your world. The PCs are possibly on level three of five, having fought their way down through the groups of goblins and orcs that live in an uneasy peace in the abandoned structure. The druid (we'll say 3.5e) is irritated by the prolonged combat, and casts "Earthquake" under a group of goblins. Now, as a GM, you are probably tempted/expected to have the spell do exactly as it says; knock the goblins down and possibly injure them from debris (been a while since I looked at 3e, I assume it did this). The way I see it, you should have the dungeon act like a hole dug out from living rock. That is, an earthquake affects it more strongly than, say, a fireball.
When the cleric casts earthquake, the room shakes and the spell's normal effects happen. Goblins fall down, some rocks fall from above and mash a few. Still, those rocks came from above. How far above was the next level? Realistically, a few dozen feet at least, as otherwise the stone would collapse by itself. Honestly though, in most dungeons it's assumed to be more like "a foot". Anyway, you are casting earthquake underground. The rocks fall, but it destabilizes the ceiling. More rocks fall the next round, and a rumbling noise reverbates around the place. The next round, the floor breaks out and the PCs fall down a level, into a twisted and broken mass of stone, worked marble, bodies, coffins, and dust.
Does this sort of thinking allow for some screwy spellcasting to completely wreck your dungeon? Yes, of course it does. Spells like Stone to Flesh make things even weirder. (Wall of Stone, Animate Object, Stone to Flesh in that order make a living, animate wall of flesh, a weird thing to encounter in all locations) However, you players start to realize that their hugely powerful high-end effects, are, in fact, hugely powerful high-end effects. This is also notable for the idiots that think they can cast Fabricate on a block of iron a few dozen times (easy for mid-level wizard) and create a hundred longswords to sell. What? No. No town has a use for all those swords. Even aside from that, you are flooding the market, driving down prices. The local smithing guild would be all over you, and probably violently. If you are too high level to confront directly, they'll probably just hire assassins. You are destroying their industry and wrecking up their livelihoods.
Anyway, back to dungeons.
How can you, as a DM, handle this sort of thing? Make your dungeon literally 3d, with defined structural components and rock hardness, add supports and engineering data, make sure it all works together in a real setting...
No, don't do all that. That sort of thing will kill you. Ad-lib it. If the party casts Fireball in the woods, the trees catch fire. If the party casts firewall in a sealed cave, the fire burns away oxygen. If the party wants to 'cheat' and go down a level in the dungeon by casting Disintegrate on the floor, let them! However, keep in mind that effects like this are more fun if the PCs didn't intend it to happen. PC plans to disintegrate the floor cause problems. Perhaps they breach a lava pipe (though the floor should probably be warm, as a hint. Don't just kill PCs randomly), or perhaps they cause another cave in. If the PCs cast Flamestrike in the sewers of a city, nothing seems to happen. However, the column of fire coming from the sky did successfully smash into a person's house up above, and when the party comes out of the dungeon two days later, they learn of the gods' judgment raining down on the city, starting a series of violent fires in the slums of the city. Casting anything at all in the middle of the city certainly causes a general suspicion of distrust of the party. Also no charming shopkeeps, they figure it out after you leave and you end up with a warrant out for you. This also means that previously fairly useless spells (Plant Growth?) become interesting again! Plants have been breaking up stone forever. It's part of their function in the world. When your cleric casts plant growth in a dungeon, the floor cracks and splinters from the new roots. I can see it being a bit more interesting.
Is this sort of spellcasting consequence limiting to spellcasters over fighters? Yes and no. A fighter just doesn't have the same kind of abilities, though I suppose he could buy a pick and just dig downwards instead of disintegrating. Also this means that spellcasters are now much less capable during barroom brawls, but if your casters were throwing around Horrid Wilting in bar brawls before, then you need to put a stop to it anyway. Another side to this is that it marginalizes fighters and their ilk in dungeons. If the druid can nuke half the level by casting Earthquake, then what good is a barbarian's greataxe? Well, for one thing, it's more controllable. I'd actually expect non-stupid (read: Long-living) PCs to lower their use of major spells in dungeons after they start seeing effects from it. What it allows, however, is more of an old-school dynamism and interestingly non-rules-based sort of environment.
So consider it. Next time your wizard is fighting off a few muggers in town by casting "Summon Earth Elemental", consider that a towering, twenty foot tall elemental is probably going to cause more trouble than a few muggers ever could. If your evil cleric starts casting Contagion on creatures, consider that many of the diseases are airborne. If the goblin collapses, coughing violently, then the players should be aware that they are in the same 20x20 room, enclosed underground, and thus are probably breathing the same Creeping Crud (or what-have-you). If the druid's pet (not spellcasting, but still) is a tamed lion, he probably shouldn't bring it to the inn. Honestly, it needs to stay in a kennel somewhere in town, if any exist that can handle such a creature. Walking around with it would likely attract the guards' attention. Have fun with it, and make magic interesting again!