It's a crapshoot. I've had good luck with engines from Nippon Motors. We got motors with around 30k miles on them and they usually had a DOA guarantee. That was years ago, though. Dunno if they're still in business even.
The trouble is that, just like a used car, you're getting an engine that someone else used and maintained (or didn't maintain). You have no idea how it was treated or how it was run.
Expect to replace anything that's bolted on to the motor, if it's even there at all. Distributor, alternator, headers, etc. The only thing you're sure to get is the head, the block, and anything that's supposed to be on the inside of those parts. For that reason, if you got a used motor you'd want to get either the same one your car came with, or one that directly bolts on to your car without having to swap anything.