While having someone's hands on the rim of your cup does seem unsanitary, I think it's just one of many unsanitary things we don't realize is happening throughout the food/drink service process. It's really unlikely to hurt you.
Instead of focusing on this I think you'll do better to remember to wash your hands frequently or use hand sanitizer. Hand-to-face contact is the principal method of infecting oneself with a cold or flu.