To keep it simplified, your retirement benefits are calculated using your highest 35 years of work. If you have worked more than that, then anything outside of your highest 35 years will not be counted in the computation of your benefits.
For disability purposes, it works in a similar way but depending on your age, how many years of Social Security contributions you have, as well as how much you’ve contributed would determine your benefit. As an example if you are a much younger person, say in your late 20’s or early 30’s there basically a curve on your record to account for missed wages because of your disability.
If you are receiving survivors benefits from someone else’s record like a spouse, there are a number of things that can come into play but the benefit is based on the deceased workers wage history, their age, if they filed for benefits before they passed, what type of benefit they filed for and maybe how old they were at that time, as well as your age and a few other details. Survivors benefits are arguably one of the most complex benefits Social Security has.