Former Senator Tom Harkin, Democrat of Iowa, has put on a suit nine times since 2014, when he retired after serving in Congress for 40 years. He counts.

He spends much of his time in the Bahamas now, where he sails and rarely looks back at his years in the Senate with any wistfulness.

“People hang on because they want to get something else done,” he said in an interview last year, “but that’s the story of life, isn’t it?”

Giving up the power, perks and prestige of serving in Congress, while confronting the reality that everyone is ultimately replaceable, isn’t always so easy. And politics at its highest levels tends to attract people who consider their job their identity — Senator Dianne Feinstein refers to hers as a “calling” — and who are afflicted with an inability to imagine a life after giving it up.

History is littered with lawmakers who have stayed around well past their primes; assurances from former colleagues like Mr. Harkin that there’s a nice life to be had on the other side can fall on (sometimes literally) deaf ears.

Strom Thurmond, the South Carolina Republican, famously hung on until past his 100th birthday. Robert C. Byrd, the West Virginia Democrat, died in office at age 92 after 51 years in the Senate. Despite serious medical issues, Thad Cochran, Republican of Mississippi, ran for re-election at 76, with the prospect of leading the powerful Appropriations Committee too good to pass up — though he later resigned before the end of his term, citing his failing health.

Ms. Feinstein, 89, Democrat of California, has announced her retirement but has refused to entertain the idea of resigning before her term ends in 2025, even as she suffers from substantial memory issues and struggles to do the job after suffering serious complications from shingles, including encephalitis.

Ms. Feinstein may appear to be uniquely stubborn, but she is far from alone in being unwilling to let go.

After decades in office, it can be hard to imagine leaving behind a life of being treated like a visiting head of state when traveling abroad, being a sought-after voice on influential Sunday shows and the guest of honor at lavish fund-raisers, and being attended to by staff members whose lives are dedicated to making the unpleasant hassles of your own fade away.

It is not just the perks, like free, reserved parking spots at D.C. airports, that make it appealing to hang on. Ms. Feinstein, after all, is wealthy, and has flown on private planes for the majority of her career.

But with long years in Congress also comes more seniority, more seasoned staff, committee chairmanships and the ability to funnel more money toward one’s state. There’s the built-in soapbox of the Senate floor, where members can champion their priorities, or rail against policies they oppose. There’s the camaraderie of being part of a team, drawn closer together by the built-in adversary that is the opposing party.

Many aging lawmakers also feel they have experience to contribute that makes them more effective than ever for their constituents as they enter life’s final chapters.

Ms. Feinstein insists that she is still effective, even though her health challenges have forced her to give up some of her power and prestige; she bowed in 2020 to Democrats’ wishes that she give up her spot as the top Democrat on the Judiciary Committee, and stepped aside rather than serve as president pro tempore of the Senate this year, a post that usually goes to the most senior member of the majority party. Still, she insists it is not time to go yet.

“I continue to work and get results for California,” she said in a statement this week.

Former Senator Barbara Boxer, a Democrat who made history with Ms. Feinstein in 1992 when the two were elected as the first female senators from California, said it is incredibly difficult to let go of a job you love, especially one in which “not only can you get things done, you could stop bad things from getting done — even as just one person.”

She described other benefits of life as a senator, a profession for which men and women have identical job descriptions and age is regarded as a virtue, not a liability.

“The Senate is a workplace where there is total equality between men and women, which is not true in most places,” she said. “Women and men get old and are not often respected, so they stay in the Senate or the House to sort of prove people wrong.”

There is also, Ms. Boxer said, “just the right amount of celebrity — it’s not overwhelming, but very satisfying when people come up and say, ‘Thank you.’”

The Senate, often referred to as the world’s most exclusive retirement home, where the average age is over 65 and octogenarians are not uncommon, also fosters an environment conducive to aging in power. There is an attending physician on hand at the Capitol, and medical prescriptions are delivered from a nearby pharmacy to the basement of the building for easy pickup.

The truncated Senate schedule — a typical week begins Monday evening and concludes on Thursday afternoon — leaves plenty of downtime, not to mention weeks and weeks of recess, when a lawmaker can really do whatever he or she pleases, especially if they represent a deeply red or blue state, like Ms. Feinstein’s solidly Democratic California, where there’s no real chance of being unseated.

Conversely, the threat of losing is often the only thing that prompts a senator to consider moving on, as Senator Rob Portman, the moderate Ohio Republican, decided to do at age 65 rather than seek re-election in 2022 in a state that increasingly leans heavily to the right.

Ms. Feinstein, for her part, poured her entire life into her work. She has never taken vacations. She had little identity outside of her role in the Senate, which at one point was formidable. People who have spoken to her over the years said she could never understand other people’s decisions to leave when there was always more work to be done.

But some of her former colleagues have taken a more balanced approach to the job.

“I felt I had done so much,” Ms. Boxer said of her decision in 2015 to end a 30-year career in Congress. “I felt good inside. I felt there was a big bench of people waiting to go. I thought, enough.”