Pain during sex

Please help, I'm on a pill for about 2 or 3 years now and for a year now when i have sex with my boyfriend it hurts, also i have often infections. What should i do?