stupid question! ⁉️❌❌

So I have really never knew the answer to this and I think I'm on the right track, but I just want to make sure. If I have an IUD, is the effectiveness, that they say, is that if he pulls out or if he cums in me? I'm 20, with a fiancé so it's not just hookups, but I just want to make sure I'm getting that part right. Never really wanted to look dumb and ask my doctor.