Plan B?

How does plan B work? I just had intimacy and my partner pulled out but I think he did it inside me a little. I don't want to risk anything so I was thinking of plan B.. Any opinions?