Can I get pregnant still ?

I started my period on the 18th my doctor told me to start loloestrin the Sunday after my period so I started my pill on the 20th then I ended my period on the 23rd and I had sex on the 25th and he came in me could I still get pregnant or does the pill start working immediately