The healthcare industry is largely seen as recession proof, but that is painting the sector with too broad a brush. Compared to other financial sectors, it is doing well, but it is still down more than 4% over the past year.

There are certainly stocks in the industry, though, that are thriving, including drug and medical supply giant McKesson (MCK 0.62%) and healthcare insurer UnitedHealth Group (UNH 0.30%). McKesson is up more than 37% so far this year while UnitedHealth is up just a little over 1%. The financial health of both companies is a strong attraction for investors looking to survive the market's current doldrums.

McKesson's size and scope make it a safe pick

Over the past 10 years, McKesson has seen annual revenue rise by 106% and earnings per share (EPS) by 29%. What makes McKesson so steady is its size and diversity allows it to provide an array of products to hospitals and healthcare companies -- and by doing so, makes life easier for them. That means more long-term contracts for McKesson. For example, it just extended its partnership with CVS Health through 2027 to distribute pharmaceuticals to CVS's mail order program, distribution centers, and retail pharmacies.

The key thing for McKesson's business is its simplicity. It distributes drugs and medical supplies, and patients have a consistent need for both.

In the first quarter of fiscal 2023, ended June 30, the company reported revenue of $67.2 billion, up 7% year over year, and earnings per share (EPS) of $5.83, up 5%. The company also raised its 2023 revenue growth from flat to between 3% and 7%, and its EPS outlook range to between $23.95 and $24.65 compared to its previous estimate of between $22.90 and $23.60.

The company does two things regularly that keep investors happy. It has raised its dividend for six consecutive years and also does stock buybacks. The company just raised its quarterly dividend by 15% to $0.54 per share. The yield, thanks to the stock's rise, isn't particularly high at 0.57%, but there's plenty of room for continued growth as its dividend payout ratio is just 6%.

McKesson said it expects revenue from its medical-surgical solutions segment to fall in the current fiscal year by 3% to 7%, but that's fine because of the company's diversity. McKesson forecasts between 11% and 14% revenue growth for its U.S. pharmaceutical segment, and for its prescription technology solutions segment, it expects 17% to 23% growth.

UnitedHealth is unfazed by recession and inflation

UnitedHealth provides healthcare insurance and medical products through its two segments, UnitedHealthcare, the nation's largest health insurer, and Optum, which provides pharmaceuticals and uses analytics to improve the performance of healthcare systems while cutting costs.

The company's focus these days is on its value-based care plans to reduce medical costs while reimbursing medical providers based on the quality of care they deliver and the level of patients' health outcomes.

The company's stock is up only a little over 1% so far this year, but over the past 10 years, it is up more than 825%, with revenue climbing 159% and EPS up 242% over that period.

The biggest area of growth I see for UnitedHealth is the growing population of those 65 and older. According to data from the U.S. Department of Health and Human Services, this group totaled 54.1 million in 2019 and that is expected to swell to 80.8 million by 2040. UnitedHealth already provides Medicare plans to one in five seniors in the United States and through its UnitedHealthcare Medicare and Retirement division, helps more than 13 million people manage their health.

In the second quarter, the company saw revenue rise 13% year over year to $80.3 billion, in large part because it added 280,000 new members through its various Medicare Advantage, Medicaid, and commercial memberships in its healthcare plans. The company also saw EPS climb to $5.34, up 18.5% over the same period in 2021. And it boosted its full-year forecast for EPS to between $20.45 and $20.95, up $0.20 at the lower and higher end from its earlier forecast.

UnitedHealth's dividend is a strong attraction for investors. This year, it boosted its quarterly dividend by 13.7% to $1.65, the 13th consecutive year it has boosted its quarterly dividend and giving it a yield of around 1.21%. With a cash dividend payout ratio of 28%, the company can afford to continue its dividend raises.

There's a common theme

Neither healthcare company is a fast grower, but they both have huge cash flows and steady growth, propelled by the trend to attempt to keep medical costs down. They also are both helped by the growing need for medical services, thanks to an increasing elderly population in the United States.

Their businesses are basically recession proof as medical needs are primary, even when consumers make cutbacks elsewhere. They also have the size to build their own competitive moats, keeping their own costs down to keep smaller competitors at bay.