Courts consider the context of enforcement, and police both decide whether something is a violation as well as handling enforcement.
And at least in the US generally you need to have been harmed, or be likely to be harmed by enforcement of a rule to even have standing to challenge it.