If the condom was hanging out of your anus, it does sound as if it came out when she pulled out. She should be holding on to the condom when she pulls out to prevent this.
In any case, the chances of an STD here are slim, if any. It sounds like you were protected the entire time. If you are concerned, you can get a test to find out for sure. Make sure you tell them you need a rectal swab. A urine test won't find rectal infections.
I think the tests would be for your peace of mind, though - it doesn't sound like you have much to worry about here.