The lid allows the air in the pan to get hotter so the food will cook faster. Not much difference in time if something cooks fast, but moisture is trapped also and changes the quality of the food cooking. Often that doesn’t matter either. The bottom of the pan gets hotter also, it’s not dissipating heat as rapidly, so something that you’re cooking at just the right temperature with the lid off might get scorched with the lid on.