What's actually going on
Your tank holds a fixed amount of hot water. When it runs out faster than it used to, one of two things happened: the tank is storing less usable hot water, or it can't reheat fast enough between uses.
The single best clue is the way the hot water fades.
Hot, then suddenly cold usually means you've lost real tank volume, and sediment is the classic reason. Warm water that turns lukewarm and just stays there usually means a heating element or dip tube problem.
Age is the other big factor. A tank under 8 years old is worth diagnosing and repairing. A tank pushing 12 that suddenly lost capacity is often just old, and no repair fully brings it back.
The usual suspects, ranked
Sediment is the number one cause across both gas and electric tanks. Minerals in your water settle at the bottom and harden over the years. On a 50-gallon tank in a hard-water area, you can easily lose 15 gallons of effective capacity to a calcium layer.
On electric tanks, a failed lower heating element runs a close second. The lower element does the heavy lifting. When it dies, the upper element still heats the top slice of the tank, so you get a teasing little burst of hot before it goes lukewarm.
A cracked dip tube is less common but sneaky. That tube is supposed to shove cold incoming water down to the bottom. When it breaks, cold water pours in right where your hot outlet draws from, and your hot water gets diluted instantly.
Then there's the boring stuff that's easy to miss: a thermostat someone nudged down, a hot fixture dripping 24/7, or a household that simply uses more hot water than it did last year.
On gas units specifically, watch the burner. A weak or dirty flame and a flaky thermocouple both slow down recovery, which feels exactly like running out too fast.