Who says God cannot be in the presence of sin? One need only read Scripture to find Jesus in the presence of sin. Perhaps you’re confusing this notion with “nothing unclean shall enter [heaven]” (Rev. 21:27).
Receiving Christ in the Eucharist forgives venial sins. The Catechism of the Catholic Church explains, “As bodily nourishment restores lost strength, so the Eucharist strengthens our charity, which tends to be weakened in daily life; and this living charity wipes away venial sins” (CCC 1394).
However, the reception of the Eucharist does not forgive mortal sins, so a person who is conscious of mortal sin must go to confession before receiving communion. The Code of Canon Law states,
A person who is conscious of grave sin is not to . . . receive the body of the Lord without previous sacramental confession unless there is a grave reason and there is no opportunity to confess; in this case the person is to remember the obligation to make an act of perfect contrition which includes the resolution of confessing as soon as possible. (CIC 916)
When a person conscious of mortal sin receives the Eucharist without prior forgiveness he commits another mortal sin and only compounds his desperate situation. Paul tells us, “Whoever, therefore, eats the bread or drinks the cup of the Lord in an unworthy manner will be guilty of profaning the body and blood of the Lord” (1 Cor. 11:27). The Church calls this sacrilege:
Sacrilege consists in profaning or treating unworthily the sacraments and other liturgical actions, as well as persons, things, or places consecrated to God. Sacrilege is a grave sin especially when committed against the Eucharist, for in this sacrament the true Body of Christ is made substantially present for us. (CCC 2120)