It varies by type of opioid and route of administration.
With something like heroin, even IV heroin, there can sometimes be a moment when one realizes one took too much. Whether or not you can do anything about it, i'm not sure. Perhaps one could administer a naloxone nasal spray since it takes a minute or two for the full effect to unfold.
But with something like IV fentanyl that doesn't really happen. When I've had too much IV fentanyl I've just woken up on the floor after the fact. You cannot call for help or self administer naloxone in the case of IV fentanyl overdose. You are almost instantly incapacitated. I have never blacked out on even massive doses of heroin in the same way I have with fentanyl. It's a lights out, "count backwards from 100", general anesthesia type situation.