Water heater longevity...
It's my impression that warranties on water heaters have mostly to do with the number and quality of the anode rods in the heaters. More anode rod means less corrosion of the glass lined steel tank, and a longer tank life.
There may be other bells and whistles, of course, to go along with a higher price.
I'm keeping my 40 year old water heater going by replacing the anode rod every 10 years or so. I also flush it out every three or four years. It's probably due now. Seems to run fine. The only hiccup in the last 20 years has been the pilot got plugged up and the entire thing stopped producing hot water. That was about two years ago. There's no sediment trap in the gas line to the heater, which means some gunk got into the pilot circuit. It wasn't hard to fix once I figured out what the problem was, and it's been running fine since. Nope, haven't put a sediment trap in the line yet. Lazy.
I did add another layer of insulation to the tank, and some foam insulation on the hot water pipes under the house. I think it helps. We'll see.
Better water heaters have two or more anode rods. One as a free standing one, which is basic. The other one is incorporated into the cold water inlet (a long pipe called a dip tube that puts cold water to the bottom of the tank, so it gets heated faster without unduly cooling the entire tankful). Although on my water heater, the dip tube is plastic. I know that because I replaced it at one point.
There are also two types of anode rods. The most common around here are magnesium, and they have a little raised dot in the center of the anode rod attachment nut at the top of the water heater. The other type is aluminum, and has a flat nut. I think the magnesium ones are better, but in some locations aluminum is used because the magnesium isn't as well suited to the water quality. And aluminum rods are cheaper.