We don't; dictionaries do
Using Merriam-Webster (others will give different results):
illegal: not according to or authorized by law
unlawful: not lawful: constituted, authorized, or established by law
Illegal and unlawful are identified as synonyms. Some dictionaries suggest that illegal has the connotation of being criminal but MW is not one of those. Which brings us to:
crime: an illegal act for which someone can be punished by the government
especially : a gross violation of law
This shows us the limits of general dictionaries because there are offenses that are punishable by the government but not criminal like most driving offenses. Which leads to:
offenses: an infraction of law especially : MISDEMEANOR
misdemeanor: a crime less serious than a felony
felony: a: a grave crime formerly differing from a misdemeanor under English common law by involving forfeiture in addition to any other punishment
b: a grave crime (such as murder or rape) declared to be a felony by the common law or by statute regardless of the punishment actually imposed
c: a crime declared a felony by statute because of the punishment imposed
d: a crime for which the punishment in federal law may be death or imprisonment for more than one year
Which shows us the other limitation of dictionaries which is regionalism because the word felony is not used outside the United States except as slang for what replaced them: a serious indictable offense (which has the right of a jury trial) as opposed to a summary offense (which doesn't). This is because, outside the USA, common law countries have not been shackled with a Constitutionally guaranteed right to a jury trial for driving through a red light so they have been able to streamline their justice systems to let a magistrate deal with the crap and only reserve juries for the serious stuff.
An act that could result in imprisonment is "a crime punishable by imprisonment" and I don't really know of any shorthand for that.