although it maybe because of not using enough lub, but it can be more complicated than that.
dose it hurts when you are having sex with in particular person or you had experienced it with some one else?
when you are having sex are you relaxed? if you have a busy mind or you are tiredmentalyy or physically the sex can hurts because youre body needs to change it's activated systemfrome sympathic to parasympathic, and a busy mind can prevent that.
finally,a mild candidia's infection which don't have much symptoms can cause pain during intercourse and you should see your doctor about it.