Investors flock to healthcare stocks with the idea that they're a somewhat safer way of getting a return. After all, medical spending is typically obligatory rather than optional, so the sector probably has a better shot at holding up in the face of a recession than others. And healthcare doesn't have complicating factors like cyclicality that make timing an investment more challenging.

But as you probably recognize already, not all healthcare stocks live up to the ideal of a low-risk investment with decent returns. In fact, over the last five years, you'd have done better buying and holding an index fund that tracked the broader market than either of the two stocks we'll discuss today even though they compete in relatively stable areas and have what -- at least until recently -- seemed like time-tested business models.

Here's why both stocks below are likely to continue underperforming.

1. Walgreens Boots Alliance

When a stock like Walgreens Boots Alliance (WBA -0.62%) jumps by 12.5% on news that it will be closing 1,500 stores, as it announced on Oct. 15 with the release of fourth-quarter earnings, it's a clear sign that there shouldn't be any assumption of safety for shareholders. Walgreens' pharmacies might seem like they're a shoo-in for consistent earnings, based on the real and constant demand from the millions of people who need to have prescriptions filled. But as it turns out, it takes more than that to appease the market.

Walgreens is undergoing this painful downsizing process in an attempt to return to profitability on an operating basis, a key benchmark it hasn't consistently met since before 2022. That shrinking of its footprint is happening even as its top line continues to grow; for its fiscal 2024, sales rose by 6.2% to reach $147.7 billion on a constant-currency basis.

So it's the inefficiency of its operations that is preventing revenue growth from benefiting investors in the form of earnings, especially considering that its dividend was cut nearly in half at the start of this year.

Management sees the company returning to positive earnings per share (EPS) on an adjusted basis for its fiscal 2025. At the same time, the company is also signaling that key headwinds will continue, like weak prescription reimbursements from insurance, weak retail sales, and pressure on its pharmacy margins.

Therefore, before you consider buying the stock, you should wait to see better results that might indicate Walgreens is on its way toward a semblance of stability.

2. CVS Health

While CVS Health (CVS -0.96%) is in considerably better condition than Walgreens at the moment, it's hardly a safe stock for a bevy of similar reasons. Its normalized diluted trailing-12-month EPS climbed by just 7% over the last five years, reaching $5.62. There isn't much indication that things will pick up anytime soon despite ongoing investments in its health services segment (which includes primary care) and its health care benefits segment (which covers insurance).

Per management, CVS is currently undergoing a multi-year, cost-savings campaign that's anticipated to cut around $2 billion in annual expenses. At the same time, by the close of this year it's expecting to reach its three-year goal of closing 900 unprofitable stores. Realizing those savings and closing those stores shouldn't result in the business losing out on a substantial amount of revenue.

Still, the question that safety-seeking investors should have is what happens next, when there's no more low-hanging fruit in the form of cost efficiencies, and no substantially unprofitable stores remaining. Simply treading water isn't enough for a stock to grow.

On that front, the health services segment isn't exactly delivering on its long-term promise to drive top- and bottom-line expansion. Its revenue was $42.1 billion in the second quarter, down 8.8% compared to a year before.

Management seems to think a decline of that scale is unlikely to occur again. But much as with Walgreens, if you're a risk-averse investor, it makes more sense to steer clear of this stock for now.