Note: This answer leans heavily on interpreting the "Body" - as the the Church, not as a referrant to Jesus, nor one's own body. I have not posted that explanation yet, in this related question : What is the referent of "body of Christ" in 1 Corinthians 11:29?
1. Question Restatement :
In 1 Corinthians 11:27-32, Paul states that a judgment is imputed onto people, who eat and drink of the cup "unworthily". How does one not eat and drink "unworthily"?
2. Clarifying - "Unworthy", "Judgment", "the Body" :
2.1. The Greek, Unworthy :
"Unworthy" - means "undeserved", "unmerited", in a legal sense where someone's actions do not merit a certain consequence.
katabiblon.com, Septuagint, Esther 8:12 - who are unworthily | ἀνάξια placed in authority.
Perseus, ἀνάξιος : ... Soph.; c. inf., ἀνάξιος δυστυχεῖν undeserving to suffer, id=Soph.:—adv., ἀναξίως ἑωυτῶν Hdt. ... 3.undeserving of evil, id=Soph., Eur. II.of things, undeserved, ἀνάξια παθεῖν Eur., etc.
2.2. To Judge or Not to Judge :
A supposed contradiction that Christians should “not judge", (Luke 6:37) or if they are supposed to "judge with righteous judgment", (John 7:24) - rests in not realizing that : although a judge can condemn, a judge can also pardon, (Luke 6:34).
2.3. "The Body, or "The Lord's Body" :
Another complication, arises because of a disagreement in early Greek manuscripts, (See Parallel Greek Texts) :
NASB, 1 Corinthians 11:29 - "eats and drinks judgment to himself if he does not judge the body rightly". (Codex Sinaiticus omits the word "Lord").
NKJV, 1 Corinthians 11:29 - ... eats and drinks judgment to himself, not discerning the Lord’s body. (The Byzantine manuscript, and many others.)
Because of this - it is often taught that one needs to examine if they are discerning that communion represents the "Body of Jesus", or whether they are judging themselves.
But, in fact - Paul clarifies this, showing that "The Lord's Body", and "The Body", both represent a "plurality" - the Church :
NKJV, 1 Corinithians 11:31 - For if we would judge ourselves, we would not be judged. 32 But when we are judged, we are chastened by the Lord, that we may not be condemned with the world.
3. The Context - Passover and Judgment :
There are many "mystical/metaphorical" illustrations of "The Cup" in view of "Judgment" in Scripture.
However - there are two contexts that stand out the most:
The Passion Narrative - Judas, having eaten the bread / cup, ate and drank judgment to himself, (better if he "had not been born”, Matthew 26:24). According to Scripture, as a Passover lamb is silent, and as its blood "covered" for the lives within a home, (Isaiah 53:7), Jesus' obedience to death (not just his death), brought forgiveness, (Philipians 2:8). From Jesus being betrayed by Judas, to being tortured on a cross, Jesus obeyed God by unconditionally advocating for the forgiveness of all, (Isaiah 53:11).
NASB, Romans 5:10 For if ... we were reconciled to God through the death of His Son ... Romans 5:18, (Interlinear) - through one act of righteousness there resulted justification of life to all men.
An Adulterous Wife, Deuteronomy 11:5-28 - The Judgment a woman drinks to herself, if she had betrayed her husband.
[Condensed] NASB,Deuteronomy 11:11-31 - 11 ... 12 ...‘If any man’s wife goes astray and is unfaithful to him ... 14 [and] if a spirit of jealousy comes over him ...
16 ‘Then the priest shall ... have her stand before the Lord ... 19 The priest shall have her take an oath and shall say to the woman, “If no man has lain with you and if you have not gone astray into uncleanness, being under the authority of your husband, be immune to this water of bitterness that brings a curse; ... ... and this water that brings a curse shall go into your stomach, and make your abdomen swell and your thigh waste away.” And the woman shall say, “Amen. Amen.” ...
4. Answer - A Judge can Decree Mercy as well as Condemnation :
Only after it is embraced that a Judge can also pardon - then 1 Corinthians 11 becomes clear in the context of the rest of Scripture :
NASB, Matthew 18:33-35 - Should you not also have had mercy on your fellow slave, in the same way that I had mercy on you?’ ... 35 My heavenly Father will also do the same to you, if each of you does not forgive his brother from your heart.”
NASB, Romans 5:18-20 - 18 ... and gave us the ministry of reconciliation, 19 namely, that God was in Christ reconciling the world to Himself, not counting their trespasses against them, and He has committed to us the word of reconciliation. 20 Therefore, we are ambassadors for Christ ...
NASB, 1 Corinthians 11:24 - and when He had given thanks, He broke it and said, “This is My body, which is for you; do this in remembrance of Me.”
NASB, 1 Corinthians 11:26 - For as often as you eat this bread and drink this cup, you proclaim the Lord’s death till He comes.
NASB, 1 Corinthians 11:31 - But if we judged ourselves rightly, we would not be judged.
Note: It is often neglected that one can even judge themselves, as God does - mercifully.**
A person who appeals to God under the law of Mercy, is unworthy of that mercy - if they do not also forfeit their own right to accuse, and become unforgiving.
Aside: The next questions that follow are : A.) "How can a person completely forgive from the heart (mind)?" And, the answer is : "By trusting (faith) into the love and mercy of God, more and more", (John 3:16, Romans 4-5). B.) Then, "How can one come to trust in the love and mercy of God?" And the answer is : "By seeing the Body show the love and mercy of God." (i.e., Real/Literal "Communion". See Webster's Dictionary.)