Tractate Chullin, Chapter 7, Mishnah 7 - the Mishnah that concludes the chapter. The Mishnah lists defects and situations where there is a difference between an animal and a person: if the defect is found in an animal, it is invalid for an offering; however, if it is found in a kohen, his service is valid from the outset.
"Eilu ksheirim ba'adam upesulin babhemah" - these are valid in a person and invalid in an animal:
"Oto ve'et beno" - the Torah forbids slaughtering a mother and its offspring on one day. It is possible that the Tanna of our Mishnah holds that the prohibition applies even to a father and its offspring, although this is not the halachah. The practical difference is for one who brings two peace offerings, one the mother and the other the offspring, the second offering is invalid due to the prohibition of slaughtering "it and its offspring" and it is forbidden to slaughter it. Conversely, if a team of a father and son work in close proximity to one another, there is no problem at all.
"Utereifah" - an animal found to have one of the defects of a tereifah, such as an internal problem from which the animal cannot survive, is invalid for an offering, even when this is discovered later. However, a kohen who has such a defect (and this refers to an internal problem and not an external blemish, such as a puncture in the lung or in the heart) his service is valid.
"Veyotzei dofen" - an animal that was brought into the world by caesarean section, meaning it emerged from the side. It may not be brought as an offering, based on the verse: "When an ox or a sheep or a goat is born", meaning specifically one born in its normal manner "will be acceptable for an offering", and it is the offering that has appeasement. However, a kohen who was born by caesarean section, there is no invalidation in this.
"Veshena'avdah bahen aveirah" - an animal with which a sin was committed, namely bestiality. According to the Tosafos Yom Tov, the place for this law is not here, and this is a textual error that should be omitted, and it does not appear in the Rambam either.
"Vesheheimis es ha'adam" - an animal that killed a person. Even though there are no two witnesses and it is not taken out to be executed, one witness or the owner's admission is sufficient to invalidate it for an offering. Conversely, a person who killed (inadvertently, or if the matter is known based on only one witness) his service is valid.
Some have sought to say that the law of "an animal with which a sin was committed" does not belong here, because such a sin undermines the very humanity of the person. But either way, the principle is clear: a person who committed a sin, his service is valid. And as was mentioned in the previous Mishnah, the kohanim do not function as individuals in their own right, but as part of the infrastructure of the Temple, almost as its instruments. They are not subjects but akin to objects performing their task. Just as a person who desecrates Shabbos and subsequently takes a lulav fulfills the mitzvah and his lulav is valid, and the desecration of Shabbos stands as a separate reckoning, so too here: although the person is a murderer, and the severity of the matter remains intact, his service is a valid service and the obligation is fulfilled through it.
It is appropriate to note the well-known law that a kohen who killed a soul does not lift his hands and does not ascend the platform to bless the congregation. This law is limited to the Priestly Blessing alone, and the reasoning for it is that the hands through which the blessings come, if they are stained with blood from killing a soul, a prosecutor cannot become a defender, and since his hands were agents for bad, they can no longer become agents for good. But he is valid to perform the Temple service itself, and the same law applies to any sin in the world.
Decree of the Sages - Sins That Invalidate the Service by Rabbinic Law:
However, the Sages established that in two areas the kohanim may not perform the service, and if they did, their service is invalid by Rabbinic law. This refers to sins in which the kohen disrespects the laws of the priesthood themselves and disgraces the institution of the priesthood, as it were. Since he does not feel his uniqueness as a kohen and the holiness of his status, they do not allow him to serve, by Rabbinic law:
"Hanosse nashim be'aveirah pasul" - the intent is not a person living with a woman forbidden to any person, such as his sister; this act is abominable and forbidden, but it does not invalidate the service, just as a Shabbos desecrator is valid for the service. The intent here is a kohen married to a woman forbidden to him due to his priesthood: a divorcee, a zonah, or a chalalah, the offspring of a relationship forbidden to a kohen. This kohen disrespects his holiness and his uniqueness, and therefore the Sages said that he may not perform the service.
"Ad sheyadir hana'ah" - ideally he must actually divorce her. But when this is not immediately possible, for example, if his chalalah wife is located in one place and he has come to serve in another place, he has the option to take upon himself an official vow forbidding any benefit from her to him and from him to her, out of a commitment to divorce later. Once he has vowed his vow, the marriage has practically ended, provided that the vow is made with the consent of the public, meaning it cannot be annulled by requesting it from another person, rather it is a binding vow. This is sufficient to validate him for the service, since the entire essence of the invalidation is by Rabbinic law.
"Hamitamei lamessim pasul" - a kohen who is not concerned about becoming impure to the dead, such as a kohen working as a gravedigger. Since the kohanim are warned not to be exposed to tumah of the dead, and he does this intentionally, he is disrespecting his priesthood and his service is invalid by Rabbinic law, "ad sheyekabel alav shelo yehei mitamei lamessim" - once he takes upon himself an official commitment before a Beis Din to cease from this work of his, he is once again permitted to perform the service.
The Message Emerging from the Mishnah: These things may be surprising, as it is not comfortable to conceive of kohanim committing sins. But the lesson is that every person, ultimately, has their sins, and we must be careful not to judge others simply because the manner of their sin is different from ours. For every good deed one receives a reward and for every bad deed one is punished - this is how the judgment is established, and there are no offsets here, and no person is perfect. Therefore, even a kohen who sinned can perform the service, since he is a kohen and part of the infrastructure of the Temple; and with God's help he too, like us and like all of us, will repent, and there will be no defect in this at all.