Kohanim were prohibited from entering the Temple after drinking a revi’is of an alcoholic beverage (about 4.5 ounces, plus or minus an ounce). Additionally, a rabbi – even a non-kohein – may not render a legal decision after drinking (see Talmud Eiruvin 64a).
The reason for this mitzvah is that it is wholly inappropriate to occupy oneself with important and holy matters, such as the Temple service and Torah study, with impaired judgment. If a kohein performed the service under the influence of alcohol, the service was not valid. (It is equally prohibited even nowadays for a person to pray while under the influence.)
These past few mitzvos – not to enter the Temple drunk, in ripped clothes, or with wild hair – also apply to non-kohanim, albeit to a lesser degree. It would not violate a Biblical injunction were a non-kohein to do so, but it was prohibited as disrespectful to the Temple.
The prohibition against entering the Temple intoxicated applied to both men and women during Temple times; the aspect of rendering a decision while under the influence continues to apply today. This mitzvah is discussed in the Talmud in the tractates of Eiruvin (64a), Kerisos (13b), Sanhedrin (22b) and Zevachim (17b). It is codified in the Mishneh Torah in the first chapter of Hilchos Biyas HaMikdash. It is #73 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos. It is not included among the mitzvos that can be fulfilled today in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar.