A word for someone always defaming people whilst constantly trying to affirm their own uprightness
Solution 1:
Such a person could be called self righteous.
Although someone could be self righteous without necessarily also being a slanderer, it is often the case that a self righteous person is also critical of the flaws they perceive in others.
Solution 2:
That person would be a twofaced, duplicitous, double-dealing, underhanded, backstabbing snake in the grass.
Solution 3:
A calumniator or slanderer is defined as someone who maliciously and without reason imputes a crime or fault to another, of which he is innocent. To calumniate means to make maliciously or knowingly false statements about someone.
What you describe is known as "building yourself up by tearing others down." People who engage in that behavior are probably suffering from low self-esteem, but I don't know if there is a psychiatric term that applies to such a person (or if you really should label someone with a psychiatric term).