The apostle Paul taught the Corinthian Christians to examine themselves before eating and drinking in remembrance of the Lord Jesus. Repentance and confession would naturally follow; after all, self-examination that doesn’t result in a change of heart and conduct is a worthless exercise.
Short version: sin must be dealt with before worship or fellowship can truly take place.