The secret to staving off burnout from those who work six or more decades: a passion for what they do and an ability to reset after late-life setbacks.

Charles Munger, the billionaire vice chairman of Berkshire Hathaway who died in November, attended a daylong Zoom board meeting at the age of 99, telling a reporter “you don’t call it work when you enjoy it.” Rosalynn Carter, who recently died at the age of 96, shook off the loss of her husband’s re-election bid to become a fierce advocate for mental health and caregivers.

Their ability and the ability of others to actively work later in life offers potential lessons to those older people who want to continue working and younger ones who already feel burned out. Nearly half—48%—of workers under the age of 30 say they feel burned out at work, compared with four in 10 of those 30 and up, according to one recent survey.

Dr. Gladys McGarey, 103, continues to consult, give talks and podcast interviews after nearly eight decades in the medical field. She started an Instagram account that has nearly 47,000 followers.

“If you burn out, relight the fire,” says McGarey. She ran a clinic while raising six children and had to start a new one when her husband and clinic partner left her when she was 69 and married one of their colleagues.

Workers ages 75 and older are the fastest-growing age group in the workforce, more than quadrupling in size since 1964, according to a recent study from the Pew Research Center. The trend will continue: Workforce participation among people 75 and older will reach 11.7% by 2030 from 8.9% in 2020, according to projections from the Bureau of Labor Statistics.

Dr. Thomas Perls, who leads the New England Centenarian Study at Boston University, says some long-lived workers have the combination of being purposeful and having the right genetics. About 25% of our ability to reach our 90s is attributable to our genetic footprint, while the remaining 75% is related to our behavior and environment, he says.

“Being purposeful and passionate can also lead to a certain degree of resilience,” he says.

Bouncing back

In addition to Munger and Carter, the achievements of several well-known figures have been chronicled in memorial tributes recently. Norman Lear, the writer, producer and activist who died in December at the age of 101, won Emmy Awards in 2019 and 2020.

Former Secretary of State Henry Kissinger continued to advise Congresses and White Houses into his 90s and published a book on leadership when he was 99. Sandra Day O’Connor, the first woman to sit on the Supreme Court, retired from the Supreme Court at the age of 75 but remained active until her late 80s, hearing cases on federal appeals courts and promoting civics education. O’Connor died in December at 93.

McGarey, the daughter of medical missionaries, grew up in India and came to the U.S. to go to medical school when women represented only 4% of the nation’s physicians.

She had four children in four years, and ran a clinic in southern Ohio while her husband, also a physician, served in the military. After moving to Arizona, she and her husband helped found the American Holistic Medical Association and opened a clinic.

Her professional and personal life was upended when she was about to turn 70 and her husband of 46 years, who has since died, said he wanted a divorce.

“I was broken,” says McGarey, who remembers at one point pulling her car off the side of the road and yelling and screaming in anger. For decades, she had helped others heal physically, mentally and spiritually, but she herself was shattered.

“I thought ‘Am I going to spend the rest of my life screaming like this?’ ” she recalls. “The very pain became a huge teacher.”

Soon after, she bought a license plate that read BE GLAD and started a new medical practice with her daughter. The husband of one of her patients cosigned the loan for their new clinic.

McGarey officially retired from her medical practice at age 86, but continued her work, traveling to Afghanistan to teach rural women safer birthing practices.

Love the work

Not everyone wants to work in their later years, says Dr. Robert Waldinger, a professor of psychiatry at Harvard Medical School.

“It’s not burnout. It’s just ‘I don’t want to do this anymore,’ ” says Waldinger, director of the Harvard Study of Adult Development, a longitudinal study on how people thrive.

As people get older, they are better at discerning what really matters, he says, and what they can let go of. The goal isn’t necessarily an 80-year career, but finding purpose in whatever we chose to do in our 80s and beyond, whether that is taking care of a grandchild, playing the piano, or joining a community theater.

For many, there is passion, purpose and love in the work.

McGarey recently published her memoir and continues offering life-coaching sessions. She has conducted an estimated 200 interviews and podcasts since May.

Every morning, she reviews the day’s lineup with her son John, who lives with her. “She thinks every person should have a reason to get up in the morning,” says John.

McGarey lives in a small home in Scottsdale, Ariz., behind her daughter’s house. Having practiced holistic medicine, which emphasizes things like nutrition and self-care, McGarey eats well, gets nine hours of sleep, rides an adult tricycle she received on her 102nd birthday, and takes 3,800 steps daily.

Like others who have remained engaged in their careers in their later years, she says the secret is to find things that make life important and our “hearts sing.”

“I think that is our key,” she says.

Write to Clare Ansberry at clare.ansberry@wsj.com