Sex hurts

When I was with my ex it didn't hurt but when I starting having sex again one year after we broke up, it did hurt even though there was a lot of foreplay and not a big penis. And the last time, it did hurt again and there was a bit of bleeding after. Why does it hurt ?