Catholics should not receive communion unless we believe in what the Church teaches and live our lives that way. Quoting St. Justin Martyr, the Catechism of the Catholic Church (CCC) teaches that, “no one may take part in [the Eucharist] unless he believes that what we teach is true, has received baptism for the forgiveness of sins and new birth, and lives in keeping with what Christ taught" (CCC 1355).
But the Church also recognizes that we all are sinners. And, while reception of the Eucharist forgives venial sins (CCC 1394), we must not receive the Eucharist if we are conscious of mortal sin: “anyone aware of having sinned mortally must not receive communion without having received absolution in the sacrament of penance” (CCC 1415).