Equity markets have been volatile throughout the year. We may or may not be out of the woods, but focusing on the short-term performance of stocks is not the best strategy. Regardless of what happens over the next six months, it's still worth it to invest in companies that look likely to perform well in the long run.

It's even better if these stocks can be bought on the dip because they have faced challenges from which they are likely to recover. Here are two great examples to consider: Moderna (MRNA 0.66%) and Regeneron Pharmaceticals (REGN -0.10%).

Person getting vaccinated.

Image source: Getty Images.

1. Moderna

It feels like ages ago that Moderna achieved monumental success thanks to its coronavirus-related vaccine work, but the company hasn't been sitting idly by since. Over the past three years, it has recorded significant clinical and regulatory progress.

The most recent was the company's phase 3 study for mRNA-1010, a potential influenza vaccine. In the study, mRNA-1010 proved 26.6% more effective than an approved flu vaccine among patients 50 and older, who are at a higher risk of severe complications and deaths due to the disease.

Moderna could earn more wins in the next couple of years. It is developing a personalized cancer vaccine, mRNA-4157, with Merck. This product is currently in phase 3 studies after producing strong mid-stage data.

Furthermore, Moderna's investigational cytomegalovirus vaccine, mRNA-1647, is also in late-stage studies. The company has several additional programs in phase 2 and phase 3 clinical trials, as well as other promising candidates in early-stage studies.

Moderna is demonstrating that its success in the COVID-19 market was no fluke. The company's mRNA platform allows it to develop and manufacture vaccines quickly, sometimes improving the efficacy of existing options. Meanwhile, there are vast unmet needs to be addressed, including diseases for which no existing vaccines exist, or those, like the flu, for which current options are less than optimal.

True, Moderna's financial results hardly inspire confidence right now. The company's revenue and earnings have declined significantly over the past three years. But investors would do well to look past that and focus on the highly promising pipeline it offers instead. The biotech should improve its financial picture as it launches brand-new products on the market in the next few years. That's why the stock is a buy, especially at current levels.

2. Regeneron Pharmaceuticals

Regeneron Pharmaceuticals is facing competition -- biosimilar and otherwise -- for Eylea, a medicine for wet age-related macular degeneration. As a result, the company's revenue is moving in the wrong direction.

But there are good reasons to stick with the biotech. Eylea's sales are also dropping because patients are increasingly switching to Regeneron's newer, high-dose (HD) formulation of the therapy. HD Eylea offers a more convenient dosing schedule.

As it earns even more label expansions, HD Eylea should help smooth out Eylea-related losses due to biosimilar erosion. Elsewhere, Regeneron's Dupixent, a medicine for eczema, continues to generate excellent sales. The therapy's recent label expansions, including in COPD and bullous pemphigoid (a rare skin disorder), will help it maintain its momentum.

Further, Regeneron has a deep pipeline. It has been making headway in oncology. The company's early-stage gene therapy for genetic deafness has shown real promise. Recently, Regeneron acquired a potential weight loss medicine called HS-20094 from a smaller pharmaceutical company.

Regeneron has been attempting to enter the rapidly growing weight management market. One of the company's candidates in this field aims to help patients maintain muscle mass during their weight loss journey, which can sometimes be a challenge.

Regeneron's shares have dropped by 47% over the trailing-12-month period, but the stock should recover eventually thanks to HD Eylea, Dupixent, and the regulatory progress on the horizon. What's more, the stock recently started paying a dividend.

For all those reasons, Regeneron's shares are worth investing in.