The stock market has taken investors for a wild ride these last few years. When you're investing in stocks for many years, though, even multiple tough market cycles shouldn't deter you from your core investing thesis about quality companies.

Even as the S&P 500 has had a pretty fantastic 2024 so far, becoming a part owner of great businesses is what you should focus on as a long-term investor. Here are two top stocks to consider buying now that you can hold for at least a decade.

1. Vertex Pharmaceuticals

Vertex Pharmaceuticals (VRTX 0.54%) hasn't been resting on its laurels. The ongoing success of its market-leading cystic fibrosis drug franchise has paved the way to a bright future as it continues to develop an impressive lineup of medicines targeting various rare, underserved diseases.

In the first quarter of 2024, the company reported total profits of $1.1 billion on revenue of $2.7 billion. Those two figures represented respective increases of 57% and 13% from the same quarter in 2023. Vertex closed out the three-month period with a hefty $10 billion in cash and investments on its balance sheet.

Vertex continues to benefit from high demand for its cystic fibrosis drugs. These drugs are helping patients live better and longer because they target the underlying genetic factors that cause cystic fibrosis. That durable need for Vertex's medicines, additional label expansions to younger groups of cystic fibrosis patients, and a massive patient population continue to form a wide moat for this mainstay of Vertex's business.

Meanwhile, the company is looking to a new era of growth as it plans multiple new product launches before the end of the decade, each with significant blockbuster potential. It's in the process of launching its new gene editing therapy Casgevy, which it developed with CRISPR Therapeutics and which serves as a onetime functional cure for sickle cell disease and transfusion-dependent beta thalassemia.

Vertex just completed regulatory submissions in the U.S. and EU for its new triple combination cystic fibrosis therapy for patients aged six and up, which addresses 31 rare mutations that Vertex's current lineup of medicines do not.

Management has also estimated that over 6,000 patients who have stopped taking its existing drugs might be interested in this new treatment option. This is just a fraction of the total addressable market for its cystic fibrosis franchise that Vertex previously estimated at around 92,000 people in Europe, North America, and Australia alone.

Suzetrigine is another potential blockbuster for Vertex, as a non-opioid drug that addresses multiple acute pain ailments. Vertex has initiated its rolling new drug application submission for Suzetrigine to the U.S. Food and Drug Administration for moderate-to-severe acute pain. It's about to start the phase 3 trial studying the drug as a treatment for diabetic peripheral neuropathy.

These are just a handful of the exciting updates about Vertex's pipeline. It also just announced that it plans to acquire Alpine Immune Sciences, a company that makes protein-based medicines for various immune disorders. The company's lead candidate, povetacicept, is being developed as a treatment for the underlying cause of IgA nephropathy (IgAN), which no commercialized drug currently addresses.

Vertex is already coming from a position of considerable strength with its market leadership in cystic fibrosis therapies that underpin a rock-solid balance sheet. Now looks like as good a time as ever to scoop up even a few shares of this top healthcare stock.

2. e.l.f. Beauty

e.l.f. Beauty (ELF 16.71%) has evolved significantly over the years, while keeping its focus on affordable, high-quality cosmetics and skincare at the forefront. The company first launched two decades ago as an online-only business.

Originally, e.l.f. only sold about a dozen products at the mere price of $1 each. Today, e.l.f. boasts a storied status as a hugely popular beauty brand with both millennial and Gen Z shoppers looking for premium makeup in a wallet-friendly price range, often as substitutes for well-known name brands.

The company is known for its TikTok campaigns, partnerships with celebrities, and creative ad initiatives that target this core consumer audience. Its family of brands includes clean beauty brands e.l.f. Cosmetics and Well People, and clean skincare brands e.l.f. SKIN, Naturium, and Keys Soulcare.

At one point, the company owned its own brick-and-mortar stores, but its bread-and-butter has been its strong online presence and lucrative partnerships with big name retailers like Target, Walmart, and Ulta Beauty. In the company's fiscal 2023, these three retailers comprised 25%, 20%, and 15%, respectively, of the company's total net sales.

Accessible prices for quality cosmetics and skincare products are a compelling buying proposition for customers in any market environment. While the beauty industry has long been the subject of feverish consumer spending, the online beauty trend fueled by social media is a newer phenomenon that e.l.f. has adeptly tapped into.

In the first nine months of e.l.f.'s fiscal 2024 that ended on Dec. 31, it generated net sales of $703 million, up 80% from the same period the prior year. Net income for the nine-month period totaled $113 million, and e.l.f. closed out that time frame with about $73 million in cash on its balance sheet.

Trailing 12-month operating cash flow for this business comes in at around $67 million. e.l.f. also has a relatively asset-light business thanks to its long-standing partnerships with third-party suppliers (a common but effective model in the beauty space).

With a robust online and brick-and-mortar retail network, and an increasingly impressive balance sheet, e.l.f. looks like a business to watch closely. Investors with cash to spare may also want to start or add to a position in this beauty stock.