Late pill help!!

J
Yesterday I was late on taking my pill for 40 minutes the same exact day I had unprotected sex but he didnt cum in me. Am I safe or? If I remember clearly my doctor says there's an hour in between and after the time I'm suppose to take it but I'm still kind of cautious