how long does sperm last

How long does sperm last in your system? I'm on the pill and my bf came inside me the first day of my period. I just get nervous about how long the sperm will last