Pain during sex

I sometimes get these cramping pains when I'm having sex, mostly when we're doing a position that allows him to be deep (or my toy when I masturbate). I also get this feeling that I have to poop but I don't, it's just the cramping. I have been to the doctors and I believe they said it is just because it is hitting my cervix and causing it to contract. I was wondering if anyone else experiences this and how they avoid it or try to work around it. My personal preference, and I'm sure along with many others, I do like it deep, and it's hard to do when I get this excruciating pain.