Doctor prescribed me medication but I don't know if it is safe please help

Kr

Has anyone had to take cephalexin and metronidazole together while pregnant in the first trimester I'm scared because read the instructions and it said ask the doctor if under 12 weeks pregnant and this medication is not used for certain patients under 12 weeks pregnant so I'm kind of scared I don't know if it will hurt my baby I have a yeast infection and BV has anyone had to take any antibiotics to prevent and help heal a vaginal bacterial infection and had a safe pregnancy