Over the past five years, the stock market has endured a pandemic and the economic issues that followed, along with inflationary pressures, geopolitical tensions, trade wars, and other macroeconomic challenges. Despite all that, equities have performed well. Though we can't predict the future in great detail, we can be confident that stocks will generally continue to deliver strong returns over the long run.

And one of the best ways to cash in on that is to invest in stocks that can exceed the market's performance. Two that look particularly attractive are Vertex Pharmaceuticals (VRTX 0.68%) and Netflix (NFLX 0.89%). Here's why these two stocks appear to be great options for investors.

Physician talking to patient.

Image source: Getty Images.

1. Vertex Pharmaceuticals

Vertex Pharmaceuticals' shares recently dropped following a clinical setback. The company's VX-993, a potential treatment for acute pain, did not impress in a phase 2 study. Management also stated that it would no longer pursue one promising indication for its new pain medicine, Journavx, following feedback from regulators. The market responded by selling off the stock.

However, Vertex's overall business remains strong, as evidenced by its second-quarter results. Revenue jumped by 12% year over year to $2.96 billion.

Vertex is still the only company that markets medicines for cystic fibrosis (CF), a rare lung disease. The company's most recent launch in this market, Alyftrek, which earned approval in the U.S. in December, is already making solid headway; it generated $156.8 million in sales in the second quarter. Vertex's monopoly in CF grants it significant pricing power, which is one of the best parts of the business and makes the stock so attractive.

The company's newer non-CF launches, Journavx and Casgevy -- the latter of which treats two rare blood diseases -- aren't yet contributing significantly to its sales, but that should change over time. Furthermore, Vertex has some highly promising late-stage assets. One of them is zimislecel, an investigational therapy for type 1 diabetes; it could help eliminate severe hypoglycemic events, potentially life-threatening side effects of the disease. Vertex plans to file regulatory applications for zimislecel next year.

That's to say nothing of various early-stage projects Vertex is working on. Recent developments were not great for the company, so it's not that surprising that the stock fell significantly.

Even so, Vertex Pharmaceuticals has faced similar one-day drops before; it usually recovers thanks to solid financial results and strong clinical and regulatory progress. Expect the biotech to do the same this time around. Vertex looks like a strong buy following its recent dip.

2. Netflix

Netflix has been on fire over the past few years. Revenue growth has been strong, and the trend continues. In the second quarter, the top line increased by 15.9% year over year to $11.1 billion. The company has experienced profitable growth recently -- it's growing not only revenue, but also profit, margins, and free cash flow.

The entertainment giant continues to benefit from the switch to streaming, but there is still plenty of white space ahead. According to management, the company still expects hundreds of millions of people to sign up on its platform. And subscriber growth isn't the only thing that will drive better results. Increased engagement, as measured by viewing hours, can help boost the company's relatively new advertising business.

Netflix estimates that it has only captured about 6% of its revenue potential, leaving it with massive long-term opportunities as streaming continues to displace cable. Competition might be an issue, but thanks to its brand name and network effects, Netflix has built a solid moat.

Valuation is another problem some investors might point to here. The stock is trading at around 48 times forward earnings, well above the average for communication services stocks, which is 20.

However, Netflix is changing the entertainment world. The company might not realize its master plan for many years, perhaps even several decades, given the massive worldwide addressable market. That's what makes its stock so attractive. For those who want to go along for the ride, Netflix's shares remain a buy even at current levels.