Despite climbing by about 12.7% last month, the S&P 500 is still down by 12% year to date. And with the COVID-19 pandemic still wreaking havoc, it is far from obvious that the worst is behind us.

With earnings season in full gear, we are now starting to see the effects of the outbreak on the financial results of corporations. Among the many companies that expect the public health crisis to hurt their financial results are Merck (NYSE:MRK) and Medtronic (NYSE:MDT). Year to date, shares of Merck have slid by 15.3%, while Medtronic's stock is down by 14.7% over the same period, which means both companies have performed even worse than the broader market. Even with this backdrop in mind, though, I believe both of these healthcare stocks are worth buying. Here's why. 

Merck still has room to grow

Merck released its first quarter financial results on April 28, and the company's performance during the quarter was strong. Merck recorded sales of $12.1 billion during the first quarter -- representing an 11% year over year increase -- and the company's GAAP net income increased by 10% to $3.2 billion.

Man holding his head staring at a board with a downward pointing graph.

Image Source: Getty Images.

Despite its solid performance during the first quarter, Merck's stock dropped by about 3.5% on the heels of its earnings release. The reason? Although Merck estimates that the effects of the ongoing pandemic on its financial results during the first quarter was "immaterial," the company said that the COVID-19 outbreak will sap $2.1 billion from its revenue during the rest of the year. 

As a result, the pharma giant lowered its guidance for the fiscal year 2020: Instead of revenue in the range of $48.8 billion to $50.3 billion that Merck had previously announced, the company now expects its revenue to be between $46.1 billion and $48.1 billion.

Despite these near-term headwinds, however, Merck remains an attractive stock to buy. The company's blockbuster cancer drug Keytruda continues to make headway. During the first quarter, sales of Keytruda were $3.3 billion, representing a 45% year-over-year increase. And given that the cancer drug is still being evaluated as a treatment for other types of cancer, there are probably many more approvals for Keytruda on the way. 

Also, the company's HPV vaccines, Gardasil and Gardasil 9, had a good quarter, with their sales increasing by 31% to $1.1 billion. Further, Merck recently announced it would spin off its "Women's Health, trusted Legacy Brands, and Biosimilars businesses" into a new company. Merck is looking to focus on its oncology, vaccines, and animal and health businesses.

According to Merck's CFO, Robert Davis, "By further evolving our operating model and separating into two simpler, more focused and agile companies, both will be better positioned to respond to the changing external landscape, improved efficiency and accelerate growth, creating greater value for patients and shareholders than would be achieved as a single company." The spin-off should be completed by the first half of 2021.

Lastly, Merck recently reached an agreement with Taiho Pharmaceuticals and Astex Pharmaceuticals, which gives Merck the rights to some of Taiho's and Astex's pipeline candidates. In exchange, Taiho and Astex received an upfront payment of $50 million, with additional incentive payments that could reach up to $2.5 billion. This agreement could help Merck further strengthen its pipeline in the future.

For those reasons (and more), the pharma giant still looks like a good stock to hold on to for the foreseeable future. 

Medtronic remains a solid long-term pick

Medtronic also expects the current outbreak to have a significant impact on its business, and the company made that clear in a recent business update. As the public health crisis continues to stretch the resources of healthcare systems worldwide, many elective and semi-elective surgical procedures are being postponed. 

As a result, Medtronic's procedure volume has declined, and the company's top line is taking a hit. For instance, in the U.S., where Medtronic typically generates a little over half of its revenue, the company said its revenue has dropped by about 60% year over year over the past several weeks. Medtronic is experiencing similar declines in its revenue in other regions as well. Given these factors, why should investors even consider buying shares of Medtronic?

Here's a good reason. Medtronic is one of the leaders in the medical devices industry and is the largest manufacturer of such devices in the world. This sector is ripe for growth, with only a tiny minority -- about 2% -- of surgical procedures currently being performed with robot assistance, according to Medtronic.

With this market set to grow at a good clip in the years to come, Medtronic is well-positioned to profit from it. Due to its sheer size, its reach across several regions in the world, and its rich lineup of medical devices, Medtronic will continue to hold a strong position in this market, and its revenue and earnings will continue to grow. Lastly, the company's financial position is strong enough to handle the current crisis.

"Over the past several years, Medtronic has made choices that have resulted in a strong balance sheet, positioning the company well for times such as these. The company currently has ample liquidity, with approximately $11 billion in cash and investments as of the most recent quarter, and an undrawn $3.5 billion credit facility. The company has no public debt maturing until March 2021," management said. 

With solid long term prospects, and the financial fortitude needed to come out of the current crisis in one piece, Medtronic looks like an attractive stock to buy right now.