Looking ahead to the next phase of life can seem pretty dreadful if you can’t stand the person who you’ll be spending it with.

That may be what some boomers are facing. Among U.S. adults ages 50 and older, the divorce rate has roughly doubled since the 1990s, according to a Pew Research Center report.

Statistically speaking we’re healthier and probably going to be living a lot longer — possibly 30 years longer — than average retirees once did. The surge in late-in-life — or “gray” — divorce is one possibly unintended consequence of this so-called longevity bonus.

Read: Why your retirement may not be so horrible after all

“What’s pushing gray divorce is people are living longer and they feel more entitled to living fully. They’ve contributed to raising children, they want an emotional journey, it’s their time now,” says Lili Vasileff, a certified financial planner and president of Divorce and Money Matters, which specializes in divorce financial planning. “They may have (decades) ahead and don’t want to be unhappy anymore.”

This is combined with a reduced stigma of divorce, both in terms of religion and society’s attitudes. People also feel more financially stable — especially if both partners have careers. But there are some serious downsides to divorce at this stage of life.

“Gray divorcees tend to be less financially secure than married and widowed adults, particularly among women,” Pew says. “And living alone at older ages can be detrimental to one’s financial comfort and, for men, their satisfaction with their social lives.”

Splitting up on the brink of retirement can be catastrophic for your finances. Even if both partners have worked there tend to be uneven levels of wealth among them. Women in particular may have taken time off work for family reasons and that eats into lifetime earnings.

How to invest and do good

Data about retirement savings and predictions about quality of life for senior citizens in the coming decades are mostly bleak. Between bumpy stock and housing markets, college tuition and scant Social Security, the financial picture of a typical near-retiree can be worrisome.

Read: It’s worse than you thought: Americans are drastically undersaved for retirement

Despite the upbeat headline numbers for the jobs report, older people at work may feel marginalized and worry that if they lose their job, finding another high-level, well-paying job will be difficult. And it’s worse if they’re forced to re-enter the labor market because of the divorce.

“The couple may be at that age where they just put kids through college and that has sucked up a lot of family assets and now one of those spouses who hasn’t been the primary breadwinner has to go out and build a career and they are standing behind the 8 ball,” says Douglas Lyons, president of Douglas J. Lyons Financial Group, a certified financial planner and a certified divorce financial analyst.

Of course, when they were younger, the rate of divorce among the baby boomer demographic was also quite high — “unprecedented,” Pew says — and that may be making things worse now. “Their marital instability earlier in life is contributing to the rising divorce rate among adults ages 50 and older today, since remarriages tend to be less stable than first marriages.”

And that tends to make finances even more complex when splitting up a household the second (or third) time around. There may be more than one set of kids competing for financial resources, or if the most recent marriage doesn’t last very long, the spouse may not be entitled to much Social Security.

Read: Divorcing after being married for decades? Here’s what to do

“When people get divorced they don’t really understand how hard it’ll be financially,” Lyons says. “It’s not 50% of 100%. There all those things you’ve been sharing — like utilities. It’s not split down the middle.”

The divorce rate for adults ages 50 and older in remarriages is double the rate of those who have only been married once, Pew says. Among all adults 50 and older who divorced in 2015, 48% had been in their second or higher marriage.

“It is vitally important that a newly divorced spouse create a financial plan to understand how their retirement plan has to change,” says David Haas, owner of Cereus Financial Advisors, an investment and advisory firm in Franklin Lakes, N.J. ”Lifestyles have to change and the right time to do that is immediately instead of when the money runs out.”

You’re invited: MarketWatch is hosting a free panel discussion on the future of robot — and human — financial advice on April 5 in downtown Boston. RSVP required, continuing education credit available. Learn more.