Christians celebrate the Lord's Supper for one reason: Jesus told them to. Just before His arrest, He gathered His closest disciples together, gave them the bread and the cup to share, and told them to repeat the celebration until He comes again (see 1 Corinthians 11:23-26).
Your pastor actually is quoting the Bible when he urges you to examine yourself and be sure you aren't taking communion "in an unworthy manner" (1 Corinthians 11:27). The Apostle Paul gave this warning to some Christians who had lost sight of the meaning of the Lord's Supper; they simply saw it as an opportunity to eat an ordinary meal together. Instead, he told them, they needed to recall Christ's sacrifice for them as they celebrated it -- and if they didn't, they would be sinning. He wasn't telling them they had to be perfect -- for no one is.
Whenever you celebrate the Lord's Supper, take time to reflect on what Jesus Christ has done for you. You and I deserve nothing less than God's judgment, for we have rebelled against God and gone our own way. As the Bible says, "There is no one righteous, not even one" (Romans 3:10).
But on the cross, Jesus Christ -- who was without sin -- took all our sins upon Himself, and He endured the judgment we deserve. The Lord's Supper points us to this great truth. Thank God for His love, and thank Him most of all for Christ's sacrifice for you.