Sacramental confession cleanses us of mortal sin, and of venial sin as well. Therefore, a Catholic who has committed mortal sin must confess before receiving the Eucharist, since he/she would otherwise not be in a state of grace and would, as St. Paul says, “receive unworthily”. . .this unworthy reception being itself a mortal sin.
Mortal sin separates us from God, and to die in a state of unrepented mortal sin would be our decision to eternally separate ourselves from God.
Normally, venial sins (which do not separate us from God but which do wound us spiritually and which, if not repented and addressed, can predispose us to more frequent sin and even to mortal sin) do not need to be confessed to the priest. Reception of the Eucharist is sufficient to remove the venial sins from a person’s soul, but their temporal effect remains.
We need the Eucharist because Christ gave us His Body and Blood, Soul and Divinity, as the true manna which is our nourishment, which is His life within us.
Therefore it is vitally important that we maintain ourselves in a state of grace through regular confession of mortal sins, and regular examination and attention to venial sins, in order to receive at least weekly the sacrament of the Eucharist.
God bless.