Pharmacy retailers serve an important purpose for many people, offering them timely advice and assistance with their day-to-day healthcare needs. That's why, unlike the retail industry in general, pharmacy retailers still offer a great deal of stability, making them attractive long-term investments. Two of the biggest names in the industry are Walgreens Boots Alliance (WBA 3.69%) and Rite Aid (RAD 20.00%). Let's take a look at which of these stocks is the better buy when factoring in their recent results, current valuation, and outlook for the future.

Walgreens is struggling to grow amid rising competition

When Walgreens announced its first-quarter 2020 results back on Jan. 8, shares were down as the company's performance during the quarter failed to impress investors. Earnings per share (EPS) of $1.37 missed analyst forecasts of $1.41, and revenue of $34.3 billion was also slightly below Wall Street's sales projections of $34.6 billion for Q1.

It also doesn't help that the company expects EPS growth to be flat for the fiscal year, suggesting that there may be some improvement, but not a whole lot, in future quarters. One of the key areas Walgreens executives said was a sore spot was prescriptions. The number of prescriptions filled during the quarter declined 1.6% from a year ago. 

Medical products in a pharmacy

Image source: Getty Images.

That's a concerning trend, as Walgreens filled 844 million prescriptions in fiscal 2019, an increase of 2.5% from the prior year, while 2018 saw year-over-year growth of 7.7%. The numbers are clearly heading downward, and with mega-retailer Amazon offering prescriptions online, the number of prescriptions Walgreens issues could continue to decline. 

However, to alleviate some of the impact of lower volumes and the more competitive pricing in the industry, the company is making efforts to reduce costs. In October, management announced a plan to try to reduce its annual costs by $1.8 billion. Walgreens CFO James Kehoe says that the movement is "gaining momentum" and indicated that the company can even exceed its initial cost-cutting target. 

One of the challenges over the years for Walgreens is that its margins have been relatively slim, with its profit margin coming in at less than 4% in each of the past four years. More competition is not going to help improve that. The one positive, however, is that the company continues to generate strong free cash flow year after year, enabling it to fund possible growth initiatives. But one concern is that in 2019, its free cash flow of $3.9 billion was its lowest since fiscal 2014. 

There are clearly some challenges ahead for Walgreens, and finding ways to grow despite rising competition is going to be key in making this one a good long-term buy.

Is one quarter enough to convince investors Rite Aid has turned around?

Rite Aid had a much different result in its most recent quarterly earnings, which it released in December. Investors were impressed, sending the stock soaring from about $8 per share to what's now its 52-week high of almost $24. Although revenue showed only modest growth, from $5.45 billion a year ago to just $5.46 billion in the third quarter, it was Rite Aid's bottom line that got attention from investors. In Q3, its adjusted EPS of $0.54 dwarfed analyst expectations of $0.07. 

The company's CEO, Heyward Donigan, credited the impressive bottom-line performance to "tight expense control" and suggested that more cost savings could be on the way: "We are also investing in the expansion and integration of EnvisionRxOptions, particularly its services, technologies and clinical offerings. This will provide us scale to deliver lower total cost of care, an enhanced client experience and heightened consumer engagement." EnvisionRx is a pharmacy benefits manager that Rite Aid acquired back in 2015. 

Overall, Rite Aid had a strong quarter, but the company is still facing many of the same challenges as Walgreens with competition on the rise. And whether Rite Aid can continue posting these strong results is still a big question mark. Prior to Q3, the company's net income was in the red for five straight quarters. And in just two of its past eight quarters has the company's free cash flow been in the black. In fiscal 2019, the company had negative free cash flow of $473 million. 

Walgreens is still the safer pick today

The temptation may be for investors to jump on the bandwagon and invest in Rite Aid. After all, it's hard to argue given that this healthcare stock has performed better than its competitor over the past year:

RAD Chart

Data by YCharts

Although Rite Aid is still trading below its book value while Walgreens has a multiple of 2, the latter also offers investors more stability. With more consistent financial results and a stronger long-term performance, Walgreens is the better investment to make today.

A disappointing quarter for Rite Aid could send the stock back down in a hurry, and the volatility there presents a significant risk for investors. Unlike Rite Aid, Walgreens also provides investors with the opportunity to earn a good dividend. The stock currently pays investors $0.46 every quarter, which yields 3.8% annually. It's also increased its dividend over the years, making it an attractive buy for both value- and dividend-oriented investors.