tampon question

Is it okay to pee when you have a tampon in? I did this earlier today when I didn't have a fresh tampon on hand, and I'm worried about infections.