This ties into the larger question of just where the Underdark ecosystem gets its energy. In the real world, life in deep cave systems is sparse and small, because it has to rely on whatever scraps of food find their way in from the outside. "Fungi" are a popular handwavy solution in D&D, probably because fungi look like plants but don't need sunlight, so people figure you could grow them in caves and solve your food problems that way. Doesn't work, though; the reason fungi don't need sunlight is that they get their energy from whatever organic matter they're growing on. They don't add energy to the system, they subtract it. Mushrooms gotta eat, too.
The simplest solution is to invoke magic. In AD&D, the Underdark had some kind of mystical "radiation" that was responsible for, among other things, the special properties of drow equipment. Drow gear eventually stopped working when you took it out of the Underdark, even if it was never exposed to the sun; you had to make periodic trips back to the Underdark to renew it. I like this idea--the mystical radiations of the Underdark are an energy source distinct from sunlight, with a whole separate ecosystem built on top of it. Or perhaps the deep Underdark is full of rifts to other planes, and plant life from those planes is the source of its energy.
Another possibility is that there's a lot more volcanic activity in a typical D&D world than there is on Earth. (Let's see a show of hands: How many DMs here have never used lava as a terrain hazard? Anyone? Bueller?) The real world has small, isolated ecosystems that thrive around deep-sea volcanic vents, using sulfur compounds released from those vents as an energy source. Conceivably, something like that on a much larger scale could drive the ecosystem of the Underdark.
A third possibility is that the Underdark doesn't have an ecosystem, and relies entirely on food brought down from the surface--either by trade (the dwarven solution) or by raids (the drow solution).
Of course, if you don't want to worry about all this, you can just wave your hands, say "Fungi," and leave it at that. Personally, I like thinking through questions like this. It makes the world feel more engaging and interesting to me, and sparks ideas for adventures.