Drugmakers developing therapies and vaccines and companies making diagnostics tests for the novel coronavirus disease COVID-19 have captured investors' attention. But there are some potential coronavirus plays that probably have a location even closer to your home.

CVS Health (CVS -0.17%) and Walgreens Boots Alliance (WBA -0.11%) have both rolled out drive-through COVID-19 testing. Both companies have also seen sales climb for their core businesses during the coronavirus outbreak. But which of these two pharmacy stocks is the better pick for long-term investors? Here's how CVS and Walgreens compare.

Pharmacist wearing a mask

Image source: Getty Images.

The case for CVS Health

CVS Health actually benefited from the COVID-19 pandemic in the first quarter of 2020 in three ways. The biggest boost was in its front-store sales as consumers stocked up on over-the-counter drugs, hand sanitizer, and other products. CVS' prescription volume increased with early refills of maintenance medications and shifts from short-duration prescriptions to 90-day refills. The company's Aetna health insurance unit experienced lower benefit costs as patients delayed elective procedures and, in many cases, avoided going to their doctors altogether.

All of these things were ancillary effects of the pandemic. CVS Health also has jumped directly into the COVID-19 fight. In early April, the company launched its first rapid drive-through COVID-19 testing sites.

It seems likely, though, that the bump CVS Health enjoyed in Q1 could quickly fade. Consumers probably won't keep on stocking up and filling prescriptions early as much with states relaxing their stay-at-home restrictions. 

But CVS Health's long-term opportunities beyond the current healthcare crisis are good. Aging demographic trends should drive higher demand for prescription drugs over the next decade and beyond. The company's ownership of Aetna gives it new ways to offer innovative healthcare products that help control costs.

CVS Health stock appears to be cheap right now, especially considering its growth prospects. The stock is still close to 20% below highs from earlier this year. CVS Health shares trade at a little over nine times expected earnings. 

The healthcare giant also offers an attractive dividend that currently yields more than 3.2%. CVS' payout ratio of 36% is low, indicating that it should be able to keep the dividend payments flowing in the future.

The case for Walgreens 

It seems likely that Walgreens Boots Alliance experienced many of the same benefits from the COVID-19 pandemic that CVS Health did. But the company's fiscal second quarter ended on Feb. 29, 2020, just before the pandemic really began to impact the U.S. in a major way. Because of this, Walgreens' Q2 results weren't impacted very much by the viral outbreak.

Walgreens' retail international pharmacy segment has been its worst-performing business lately. The COVID-19 outbreak has hit several European countries especially hard. It won't be surprising if sales for the company's lagging segment jumped nicely in March and April.

The company quickly saw an opportunity with the COVID-19 pandemic in the U.S. Walgreens began to provide COVID-19 testing spaces outside its stores in mid-March. In early April, the pharmacy retailer expanded its drive-through COVID-19 testing service.

Like CVS Health, Walgreens is poised to profit from long-term aging demographic trends. These trends won't just help the company in the U.S.; they should boost Walgreens' sales over the long run in its international markets as well.

Walgreens stock is even cheaper than CVS Health. Shares are nearly 37% below the highs at the start of the year and trade at only seven times expected earnings.

In part because of this steep decline, Walgreens' dividend yield stands above 4.7%. The company's dividend program boasts a long and successful track record, with Walgreens ranking among the elite group of stocks known as Dividend Aristocrats -- members of the S&P 500 that have paid a dividend for at least 25 consecutive years.

Better coronavirus stock

My view is that there's a reason why CVS Health's valuation isn't quite as low as Walgreens' and its shares haven't fallen as much as its top rival's shares have: CVS is the better stock. However, it remains to be seen which of these two companies benefit more from the COVID-19 pandemic. I think that CVS Health's acquisition of Aetna sets the company up for greater long-term success, though. 

CVS Health hasn't been one of my favorite stocks in the past. But with its current valuation and solid growth prospects, I think the stock is a pretty good pick now.