While I’m being treated can I still use tampons?

I have a yeast infection and bacterial vaginosis which I am being treated for. I just got my period and I bleed heavily. Useful I use a menstural cup but I’m afraid taking it out and reinserting it may lead to me get the infections all over again. Are tampons safe to use? Or should I just stick to pads? My medicines are all pills.