You must not live in California if you're seeing good condition Fits and Yarises for $5k, that's for sure! How many miles a year do you drive? What is your tolerance for failure? For example, do you have a job where you can call your boss and have everything be OK if your car breaks down on the way to work, or do you need reliability above all else? Do you have a spouse or other family member who you can carpool with if you need to have your car in the shop for a few days?
My hesitation on suggesting you buy anything in the $5k price range is the fact you said you want to have this car for at least 10 years. Over that kind of timeline, fuel, repairs, and even insurance make up a huge portion of the total cost of ownership, not just the purchase price. A $12k Prius likely has a bit more life left in it than a $5k Fit or Yaris, but on the used car market everything is a case of "it depends."