The Catholic Church refers to some things as “valid but illicit” (such as the SSPX’s decision to ordain priests without prior permission from the pope), and other things as “invalid” (such as women’s ordination). For this post, I chose ordination, specifically, but what I’m saying here applies to everything considered “valid but illicit” v. “invalid.”
There’s an easy way to understand the difference between “illicit” and “invalid.” In Exodus 17:6, God gives Moses the ability to strike a certain rock, and bring water forth from it: this is later identified (1 Cor. 10:4) as a foreshadowing of Christ. Well, in Numbers 20:7, God tells Moses to speak to the rock, and water will come forward. Apparently, this struck Moses as just too bizarre, so he struck the rock (twice) instead (Numbers 20:11). God punishes Moses for disobeying Him by refusing to let Moses into the Promised Land (Numbers 20:12), but it’s significant that when Moses struck the rock illicitly, “Water gushed out, and the community and their livestock drank” (Numbers 20:11). So that striking of the rock was valid but illicit. It still produced water, it just wasn’t done in the prescribed way. Had some random person taken a stick in beaten the rock, it would have been invalid, and nothing would happen. Invalid actions are, by definition, illicit. You can’t licitly do something invalid.
The consequences of a valid but illicit ordination mean that the ordained person is, in fact, a priest (or a bishop, if that’s what you’re ordaining them to). An invalid ordination, on the other hand, is just a sham, like the priests of Ba’al trying to call down fire from Heaven. Since valid but illicit and invalid ordinations are all illicit, they’re all punishable – in this case, by automatic excommunication. So the excommunicated SSPX bishops, for example, are both bishops and excommunicated. Women attempting ordination become excommunicated, but don’t become bishops.
Like I said in the beginning, I chose ordination to explain this distinction, but there are plenty of other things which could have been chosen. The Latin Church has opted to use unleavened bread only for the Eucharist. Using bread with yeast is valid but illicit: the Eucharist occurs, but it’s still a punishable sin of disobedience. On the other hand, using something besides bread, or using mixing in honey, eggs, etc., means that the Eucharist never occurs: it’s invalid (of course, it’s still punishable, sinful disobedience).