Advice on buying junkyard engines?

I’ve never bought one from a yard but have bought vehicles for there drivetrain. I’ve had very good luck doing it this way, usually the vehicle has body damage and it’s cheap. In fact I bought a 77 Dodge Royal Monaco with a 440 for a $100 bill and all it needed was a header panel, I put the header on it and drove it for three years before pulling it apart. I’ve bought cop cars for wheels etc I just don’t think you can go wrong, hell you get to drive it before you buy it.