You're probably pretty safe. I'm pretty sure the only serious thing you could catch would be herpes, and even that I doubt. Almost all STDs are spread sexually or by blood. So if these people had cuts on their mouth and left blood on the rim of the cup, and then you drank from it and also happened to have cuts on your mouth, and their blood mixed with yours by chance... See how unlikely that is?
Also hepatitis, I hear that can be spread by saliva. But still, pretty unlikely you'll get it.
Maybe you could get mono? But that's nothing too harmful.
You should avoid drinking from other people's cups anyway, you don't know what they're spiked with. Rohypnol, the date rape drug, is colorless, odorless, tasteless, pretty much undetectable. And it only takes 15 minutes to go into effect. It impares your judgement and motor skills. If you get sexually assaulted, there's a high chance you won't remember what happened. The drug, when slipped into alcohol, can cause blackouts lasting 8-24hrs. You have to be careful about drinking things that you can't fully account for, you don't know if some jerk slipped in a roofie. They only cost like, less that 5 bucks a pill so it's not like it's hard to acquire.
Next time just stay away from other people's drinks and you wont be scared. You'll be fine this time though, dont worry.