Help!?!?

I have a pretty light period is it safe to use a tampon?? I wanna go swimming. If I can use one how long can it be in. I’m new to this whole thing.