Throwing up only makes the pill ineffective if it’s within 3 hours of taking it. For diarrhea it is a bit iffy, but the guideline we tend to follow is 6+ trips of complete liquid stool within 24 hours. Remember this isn’t foolproof, so you need to be the judge of it.
If you feel like your pill was compromised you can take another if you’re still in your usage window, if not then you should follow your pamphlet instructions on what to do when you miss a pill in the week you’re currently in. It will also mention you if you need a back-up method and how long for but only if your protection was affected.