When you say dead, what does that mean? Ran low on oil, timing chain jumped, overheated?
If this is a 4-cylinder don't bother searching for a used engine. the 2005 model year you are referring to has the head bolt issue. If it has overheated you're looking at a new short block. I wouldn't trust a 2005 2azfe. 2007 - 2009 have the piston rings issue. If you have a bore scope you can check for damage on the used engine's cylinder walls but if it doesn't have it yet, it probably will unless you see grey silicone and not black peeking out the cracks of the valve cover and timing cover. Then MAYBE the engine had the pistons and rings replaced by Toyota.
I am going through this now and I can tell you that I spent months researching the options. I went through the scrap yards with my scope and I found one engine worth pulling. By the time I got back with my tools someone else was already pulling it! I ended up replacing the short block and cylinder head instead of buying a reman or installing a used engine. That was the only way I could be certain that I wouldn't be back in this situation again in the next few years.
If you are fortunate enough to have a V6 then you can ignore everything I just said.