Dividend stocks can be great additions to anyone's portfolio, and it's even better to buy quality ones when they're down. While the market has roared back this year following a downturn in 2022, it is still possible to find solid dividend-paying companies lagging the broader equity market.

Here are two examples: CVS Health (CVS -0.22%) and Viatris (VTRS 0.87%). These two healthcare companies could be excellent picks for dividend investors focused on the long game. Here's why.

CVS Chart

CVS data by YCharts

1. CVS Health 

Shares of CVS Health are down by almost 22% since the year started. Much of that decline resulted from the company's first-quarter results, where it slashed its guidance -- a move investors aren't fond of seeing. However, CVS Health's performance during the second quarter was enough to send its stock price up by 3%. During the quarter, the company's revenue of $88.9 billion increased by 10.3% year over year.

The pharmacy chain and health insurer's adjusted earnings per share of $2.21 dropped by 12.6% year over year, but it's important to look deeper at this number. The company blamed its healthcare benefits and pharmacy & consumer wellness segments for the decrease. In the latter unit, operating income suffered partly due to reductions in coronavirus vaccinations and diagnostics. That isn't a problem that will affect CVS Health forever.

At any rate, the company's results were solid overall.

Still, the healthcare giant's shares remain down, as does its forward price-to-earnings (P/E) ratio. CVS is trading at a forward P/E of 8.5, less than half the healthcare sector's average earnings multiple of 17.8. CVS Health looks attractive at these levels, given its extensive footprint as a pharmacy chain all over the country, entrenched position in many communities, and overall diversified healthcare business.

There is CVS Health's insurance division and its ventures into the primary-care business. CVS Health doesn't just want to offer patients prescriptions -- it wants to hold their hands through much of their medical care journey. A higher demand for medical services created by an aging population means CVS' business should continue to perform relatively well over the long run. 

But what about the dividend? CVS Health offers a yield of 3.27%, while it has increased its payouts by 169% over the past 10 years. The company's modest cash payout ratio of about 17% shows substantial room for more hikes. All that makes CVS Health an excellent option for value and income-seeking investors. 

2. Viatris

Viatris has existed for less than three years. In November 2020, Pfizer divested its generic drugs unit Upjohn to Mylan, a company that specialized in that area. The new corporation that was formed, Viatris, is one of the leading generic drug manufacturers in the world.

However, it has significantly underperformed the broader market since its IPO. Even in 2023, Viatris' shares are slightly in the red. The company has faced several issues, notably slow or nonexistent revenue and earnings growth.

So Viatris is seeking to reinvent itself. In November 2022, it divested its biosimilar business to India-based Biocon. Viatris isn't done -- management made it clear that more divestitures are on the way and will be announced later this year. The goal for Viatris is to streamline its business and focus on areas with higher growth opportunities.

Viatris isn't quite there yet. In the second quarter, its net sales declined by 5% year over year to $3.9 billion. In fairness, that was due to last year's shedding of its biosimilar business and the negative impact of foreign exchange rate fluctuations. Putting those aside, Viatris' top line would have grown by a modest 1% year over year, which is better but still not particularly impressive.

The company's adjusted net earnings declined by 15% year over year to $905.4 million. So it's not too surprising that investors have been skeptical of Viatris in recent years. But with a vast portfolio of generics, a full pipeline of medicines that should meaningfully contribute to its top line in the next few years, and the fact that the generic drug market helps patients save lots of money, Viatris still looks like an exciting pick.

That's especially the case since the shares trade at a measly forward P/E of 3.7, and the company is working on giving its business a makeover that should decrease costs and boost efficiency. Viatris' dividend yield tops 4.53%, and its cash payout ratio is only about 25%. So dividend investors can safely add Viatris' stock to their portfolios.