I borrowed this answer from Wikipedia. I could not word it better myself, but it explains how confounding variables work:
As an example, suppose that there is a statistical relationship between ice-cream consumption and number of drowning deaths for a given period. These two variables have a positive correlation with each other. An evaluator might attempt to explain this correlation by inferring a causal relationship between the two variables (either that ice-cream causes drowning, or that drowning causes ice-cream consumption). However, a more likely explanation is that the relationship between ice-cream consumption and drowning is spurious and that a third, confounding, variable (the season) influences both variables: during the summer, warmer temperatures lead to increased ice-cream consumption as well as more people swimming and thus more drowning deaths.
I also borrowed this explanation from mst, an edu webpage:
One of the most common types of confounding occurs when an experimenter does not or can not randomly assign participants to groups, and some type of individual difference (e.g., ability, extroversion, shyness, height, weight) acts as a confounding variable. For example, any experiment that involves a comparison of men and women is inherently plagued with confounding variables, the most commonly cited of which is that the social environment for males and females is very different. This does not mean that there is no meaning or value in gender comparison studies, or other studies in which random assignment is not employed, it simply means that we need to be more cautious in interpreting the results.
What I would interpret from this is that confounding variables are inherently difficult, or impossible, to control. We need to be aware of the confounding variable and try to conduct the study in a way that we can measure our results despite its existence. If you refer back to the ice cream consumption and drowning occurrences, and you know that the confounding variable is the season, you can repeat the experiment in different seasons. If you know that the confounding variable is gender, you can conduct separate experiments that are gender-specific. You can also account for error by using a standard deviation that will give a range of accuracy, despite the confounded variable.
Good luck,
Jane