Investors looking to participate in the stock market have a multitude of options, and it can sometimes be hard to separate the wheat from the chaff. But some companies look especially attractive, perhaps due to reasonable valuations, excellent prospects, or other factors.

Buying shares of such businesses and holding onto them for a while is one of the secrets to earning outsize returns over the long run. Let's examine two healthcare stocks that look like excellent picks right now: AbbVie (ABBV -2.04%) and Veeva Systems (VEEV -1.66%).

1. AbbVie

Pharmaceutical giant AbbVie isn't doing well in the stock market in 2023 thus far, and the reason behind that is no secret. The company lost U.S. patent exclusivity for its blockbuster drug Humira earlier this year. Biosimilar competition is already eating into the market share of the rheumatoid arthritis medicine. Due to this major patent cliff, AbbVie's sales will continue to decline until next year.

But these developments shouldn't have been a surprise. Humira is one of the best-selling drugs in the history of the industry. Losing patent protection was always a highly anticipated event. And what's more, AbbVie had prepared to deal with it. Once the dust settles, the company's revenue should start growing again, largely thanks to a duo of immunology medicines, Skyrizi and Rinvoq.

These drugs continue to earn key indications, many overlapping with Humira's most important ones. Management has predicted that Skyrizi and Rinvoq will eventually combine to exceed Humira's peak annual sales, something that should happen by 2027. There are other key growth drivers that will help AbbVie. Among them are migraine treatment Qulipta, depression medicine Vraylar, cancer therapy Venclexta, its Botox franchise, and potentially brand-new products that will come out of the dozens of programs currently in the company's pipeline.

AbbVie could also make new acquisitions, according to CEO Richard Gonzalez. So patient investors can rest assured that the drugmaker will eventually bounce back. Nor will AbbVie threaten its excellent dividend program because it is part of the prestigious group of Dividend Kings. The company has raised its payouts by about 54% in the past five years alone.

The market has punished AbbVie's stock despite its still bright long-term prospects and excellent dividend history, and that's what makes the company a no-brainer buy as its shares look very attractive at current levels. AbbVie is trading at a forward price-to-earnings (P/E) ratio of just 12.3, much better than the pharmaceutical industry average of 15.9.

With AbbVie's stock, investors should follow the advice of Warren Buffett and be greedy when others are fearful. 

2. Veeva Systems

Veeva Systems offers a suite of cloud-based software solutions tailor-made for pharmaceutical, biotech, and medical device companies. Corporations in this industry face unique challenges. Bringing their products to market is a long, capital-intensive process that also requires abiding by a barrage of strict laws and regulations, and failure to do so can have costly consequences. Veeva Systems makes things easier for its clients.

The company's services are incredibly valuable, and it's not easy for its customers to migrate to a competing provider of cloud-based software programs for the life sciences. The shift would risk slowing the process of getting products to market, as well as the the loss of valuable data -- all serious potential pitfalls pharmaceutical companies would want to avoid at all costs.

That gives Veeva Systems' business a competitive edge in the form of high switching costs, and it is a crucial reason why the company is such an excellent stock to buy. Here is another: Veeva Systems still has plenty of growth potential left. After all, the life sciences industry is massive. The company estimates its total addressable market (TAM) is worth more than $13 billion.

Its current top line is a mere fraction of that figure. In the first quarter of Veeva's fiscal 2024 (ended April 30), the company's total revenue of $526.3 million increased by 4% year over year. For its full fiscal 2024, Veeva expects its top line to come in between $2.36 billion and $2.37 billion. In other words, even grabbing an additional 20% of its $13 billion TAM would more than double its revenue compared to what it expects for its current fiscal year.

VEEV PE Ratio (Forward) Chart

VEEV PE Ratio (Forward) data by YCharts

Looking at valuation, Veeva Systems' stock isn't cheap, but its forward P/E of 43 looks reasonable compared to where it stood in late summer of 2022. In my view, the company will justify this valuation over the long run for investors who hold onto its shares.