Plan B???

Is the pill plan B as effective as I hear??
Boyfriend and me were having sex just now and he was gonna pull out and cum on me but we think he came a bit in me first..... He's on his way to get plan b rn.. How long should I wait to take it? And will it work??????