In the short term, sentiment towards a stock can often matter more than its fundamentals. But growing revenue and earnings matter far more when looking out 10, 20, or 30 years into the future. This is what ultimately leads stocks to deliver impressive total returns and allows shareholders to amass a high net worth.

Here are a couple of healthcare stocks to contemplate buying that could do well for shareholders in the years that lie ahead.

A doctor and patient discuss test results at an appointment.

Image source: Getty Images.

1. Elevance Health

Elevance Health (ELV -1.57%), formerly known as Anthem, is the third-largest publicly traded health insurer in the world, with a $117 billion market capitalization

Due to an increase in instances of common diseases like cancer and diabetes, the demand for health insurance is positioned to rise moving forward. That's why the global health insurance industry is expected to grow at a rate of 9.7% each year, from $2 trillion in 2020 to $4.2 trillion by 2028. 

Elevance Health's status as a well-established health insurer leads analysts to believe that it will be able to generate 12.6% annual earnings growth over the next five years. The stock's dividend payout ratio stands at 18%, which should enable the dividend to grow ahead of earnings for the foreseeable future. This is why I'm forecasting mid-teens annual dividend growth from Elevance Health over the medium term. 

The stock's 1.1% dividend yield is moderately lower than the S&P 500 index's 1.6% yield. But Elevance Health's growth potential makes it an ideal dividend growth stock

And the stock's forward price-to-earnings (P/E) ratio of 14.9 is just below the healthcare plan industry average of 15.7. Since Elevance Health's 12.6% annual earnings growth outlook is in line with the industry average of 12.8%, the stock seems to be an excellent buy for long-term investors. 

2. AstraZeneca

AstraZeneca's (AZN -0.31%) $196 billion market cap positions it as the seventh-biggest pharma stock on the planet (along with Switzerland's Novartis). 

The company's portfolio consists of more than a dozen products that are on pace to record at least $1 billion in sales in 2022. The most notable products in AstraZeneca's portfolio include cancer drugs Tagrisso and Lynparza, cardiovascular/renal/metabolic drug Farxiga, and rare disease drugs Soliris and Ultomiris. These products are the reason that AstraZeneca was able to post double-digit revenue and earnings growth in the first quarter of 2022. 

And similar growth should continue well into the future. This is because AstraZeneca has more than 180 projects in different stages of clinical development in its drug pipeline. It's anticipated that some of these projects will be commercial successes for the company, which is why analysts are predicting 15.4% annual earnings growth for the next five years. 

AstraZeneca also offers investors a market-topping 3.6% dividend yield. And the stock looks like an attractive buy for every type of investor. AstraZeneca's forward P/E ratio of 17.4 is far higher than the industry average of 11.5. But this premium to its peers is well-deserved since the stock's annual earnings growth potential of 15.4% is more than double the industry average of 7.1%.