PLEASE HELP: bleeding after sex

(kind of gross, but please help)

Hi i am 17 and this was my third time having sex. I noticed when he was pulling out that i was bleeding. the bleeding lasted a few hours so i thought it was my period but then it stopped. why is this? also this was my first time having sex in several months and it hurt a little. please let me know what i should do, thank you! im scared and i dont have anyone to talk to about this stuff. also i have never bled before after sex but yesterday i did it from the back. sorry if thats too much information im just afraid.