Hi, there could be failures with the condome, or a pill can have a failure, by it self or occassional missing.
The expelled piece appears to be the remnant or a miscarriage
. there could be a remnant still in side and if it is the case, there will be excessive bleeding or infection causing cramps etc. So i advise you to consult a physician for diagnosis and treatment. thank you.