The mushrooms will try to spread and fill the level. To prevent them from growing, make matches right next to the mushrooms. The match will cause damage to all the mushrooms, and while they are damaged, they do not grow.
Active (spreading) mushroom
Damaged (non-spreading) mushroom
Removing all mushrooms is not necessary in order to get through the levels. However, you might want to keep the top of the level clear from the mushrooms, so that new matchable items would fall down to the level to fill any empty tiles.