Is the manufacturer's warranty or the 10 year/150k mile California emission warranty for a hybrid battery valid on pre-owned hybrids?

Does it matter if it's not a certified pre-owned or if i buy the hybrid from a small local dealer or from a private party? Will it still be honored by the manufacturer if it's still within the warranty period?

With the budget I have, I plan to very soon buy a pre-owned 2007 or newer hybrid with hopefully no more than 65k miles on it. I've narrowed it down to either a Camry Hybrid or an Altima Hybrid and my preliminary comparisons indicates I can get a better deal buying a non-certified pre-owned from either a non-Toyota or a non-Nissan dealer.

My plan is to do this and then, if possible, still purchase an extended warranty from Toyota or Nissan. Other posts here suggests that I can get a better deal on the extended warranty by buying them from out-of-state Toyota or Nissan dealers.

Can anyone tell me if this is a good plan or not?

Thanks in advance.