Well, firstly remember that it’s people in MORTAL (serious) sin only, and only those who divorce AND remarry without annulment of the first marriage, that can’t receive communion.
Secondly - of COURSE we need Jesus when we are in sin, and we need His help with our sins. And we get that - through the sacrament of Confession. THAT is the way we get His help when we are in sin. Each of the sacraments has their purpose, not all have the same purpose. Someone who wants to become a priest goes to the sacrament of Holy Orders to do so, not the sacrament of marriage or confirmation or something.
Now let’s look at the definition of mortal sin - as per 1 John 5:16 it is the ‘sin unto death’ (that’s what mortal literally means). Obviously that means that these sins kill the soul. Kill stone dead the person’s communion with God.
Now if we draw an analogy between a dead soul and a dead body - the Eucharist is food, right? In both a physical and spiritual sense. You don’t give food to someone who is dead, do you? Because food doesn’t help a dead person, only a living one. So it serves no useful purpose to give a soul that is in mortal sin the Eucharist.
Quite the contrary in fact. If we think of what communion actually is and does - we become absorbed into Christ and united with Him - it’s actually a foretaste, in a lesser sense, of Heaven where righteous souls have the beatific vision and become united with God, seeing Him face to face.
You know that a soul in mortal sin can’t get into heaven - nothing that is imperfect can come into that sort of total communion with God. So no souls that are not at least in a state of grace and free of mortal sin can come into the lesser union with Him that is Holy Communion.
Finally, remember the words of Paul saying (it’s in 1 Corinthians 11, can’t be bothered quoting it verbatim) that those who eat and drink unworthily eat and drink their own condemnation. He points out that such is the power of the Eucharist that people who receive unworthily get physically ill and die. Funny how over the past few decades we’ve become, as a society, so much more physically unhealthy in step with our fading spiritual health, I wonder if it’s really koinkydink …
An analogy here might be someone who has diabetes - a condition that means they can’t properly process sugary foods if they eat them. So sugar, which is fine in moderation for a healthy person, becomes not just harmful but potentially deadly for them because they lack the capacity to properly absorb it.
So a soul that is in mortal sin not only lacks the capacity to obtain the spiritual benefits of doing so, but is actually harmed by its spiritual power.
Hope this helps.