There are plenty of reasons to invest in healthcare stocks. Traditionally, they tend to be more inflation-proof and recession-proof because healthcare isn't something people can do without, particularly those with special conditions.

The long-term trends of an aging and heavier population also point toward growth for the industry. In 2020, a report by the Centers for Medicine and Medicare Services said that U.S. healthcare spending grew in just one year by 9.7% to $4.1 trillion, representing 19.7% of the gross domestic product. The report also said that figure is expected to reach $6.2 trillion by 2028.

Not all healthcare stocks are created equal, however. ResMed (RMD -3.88%) and UnitedHealth Group (UNH -2.95%) stand out because they are dominant players in their healthcare sectors. ResMed is the largest U.S. provider of sleep apnea devices, and UnitedHealth is the largest health insurer in the U.S. Their size gives them built-in advantages over the long run.

A patient wearing a sleep apnea mask in bed.

Image source: Getty Images.

Don't sleep on ResMed

ResMed builds machines to help patients with sleep apnea, asthma, and chronic obstructive pulmonary disease (COPD). According to ResMed CEO Robert A. Douglas, sleep apnea may affect 930 million people around the world, but only a portion of them have been diagnosed with the condition. That means the total addressable market has barely been tapped for the company's products.

Over the past five years, ResMed has given investors a total return of 276%, and that's despite being down more than 5% so far this year. Through the first six months of fiscal 2022 (through Dec. 31), the company reported $1.79 billion in revenue, up 16% year over year, with earnings per share (EPS) of $2.76, up 13% over the same period in fiscal 2021. Over the past five years, the company has increased annual revenue by 55% and annual EPS by 35%.

What makes ResMed attractive is that its revenue streams go beyond its machines. In the second quarter, 38% of the company's revenue came from the peripherals to those machines, such as masks and filters, that must be reordered. This is important because the company now has 115 million subscribers. On top of that, the company has a growing SaaS (software as a service) business that helps medical professionals keep track of patients, and that accounted for 11% of the company's revenue in the quarter.

The recall in June of some CPAP (continuous positive airway pressure), BiPAP (bilevel positive air pressure), and ventilator machines made by a subsidiary of Koninklijke Philips Electronics NV should also continue to benefit ResMed. While ResMed won't pick up all that business, it won't hurt it either, something ResMed discussed in its second-quarter earnings call.

ResMed also offers a quarterly dividend, which it raised by 7.6% last year to $0.42 per share, which works out to a yield of 0.68%.

UnitedHealth Group shows bigger can be better

UnitedHealth, the largest health insurance company in the United States by market cap ($495 billion) and by market share (14.1% according to Statista data), operates as an insurer and as a managed healthcare provider. Despite a market slowdown this year, its shares are up more than 5% this year, and over the past five years the stock has delivered a total return of 237%. It also has increased annual revenue by 42.5% and annual EPS by 68.7% in that time frame.

The UnitedHealthcare side of the company provides healthcare benefits to individuals and employers, including Medicare and Medicaid beneficiaries. The Optum side of the business provides managed care with pharmacy services and technology-driven products designed to keep healthcare costs down.

The company reported fourth-quarter and full-year 2021 earnings on Jan. 19. Revenue for the year was listed at $287.6 billion, up 11.8%, including double-digit growth for UnitedHealthcare and Optum. Full-year EPS was $18.08, up from $16.03 in 2020.

The company gave bullish guidance back in November, which it affirmed in the annual report. United said it expected annual 2022 revenue of between $317 billion and $320 billion and annual EPS of $20.20 to $20.70.

The company went to a quarterly dividend in 2010 and, since then, has increased its dividend every year. That includes a 16% bump last year to $1.45 a share, which works out to a yield of 1.10% at its recent stock price.

RMD Total Return Level Chart

RMD Total Return Level data by YCharts.

Stable choices in unsteady times

ResMed and UnitedHealth have increased its annual revenue for more than a decade. Of the two, ResMed's revenue growth has been stronger over the past five years, but UnitedHealth has increased its EPS more. That UnitedHealth is faring better so far this year shows it may be more resistant to a downturn. On top of that, its slightly better dividend yield makes it an even better long-term choice.