Investors aren't thrilled about the short-term growth prospects for consumer staples companies like Clorox (CLX -0.69%) and Procter & Gamble (PG -0.78%). While sales are rising for both companies, demand trends have softened following the pandemic surge. Profit margins are under pressure from cost inflation, too.

Yet the current pessimism on Wall Street might be creating an excellent opportunity to own these companies, which maintain dominant market share in some essential niches. And their dividend yields provide a nice bonus for shareholder returns as well.

With those positive factors in mind, let's take a look at which of the two stocks looks like the better long-term investment from here.

The latest results

The companies look similar right now on the growth front. Procter & Gamble said in late April that organic sales rose 7%, while Clorox announced an 8% jump for roughly the same period.

Growth in both cases is coming more from price increases than anything else. That's a mixed signal for the businesses. On one hand, it's good to see that P&G and Clorox can pass along higher prices to consumers without sacrificing overall sales growth.

On the other, it would be preferable to see a balance between rising prices and increased sales volumes. Instead, the two management teams have described the current sales environment as "challenging" as consumers look to save cash. P&G is predicting a roughly 6% organic sales increase this fiscal year, while Clorox is aiming for between a 3% and 4% uptick. Give the growth edge to P&G in this case.

Profits and cash

The profit picture is brighter for both companies thanks to the combination of rising prices and moderating cost increases. Yet P&G is the clear winner on this score as well. Operating profit margin is holding above 20% of sales, roughly double Clorox's rate. The marketer of detergents, paper towels, diapers, and other daily essentials also handily beats peer Kimberly-Clark (KMB -0.87%) on profitability.

PG Operating Margin (TTM) Chart

PG Operating Margin (TTM) data by YCharts

Choosing either stock would likely expose you to significant cash returns over the next several years. P&G recently hiked its 2023 goal and now expects to deliver roughly $17 billion to shareholders through dividends and stock buybacks. Clorox's ability to generate cash isn't quite as impressive, but its trends are improving thanks to inventory cuts. It pays a higher dividend yield as of early July, too, coming in at 3% compared to P&G's 2.5%.

As you might expect, investors are paying different prices for these two businesses. P&G's higher growth, profit, and cash flow profile has resulted in a price-to-sales ratio of 4.7, higher than Clorox's 2.7. Investors seeking values might be tempted to buy Clorox here in hopes of watching as the company's earnings and growth trends rebound over the next several quarters.

Yet P&G has earned its premium by consistently boosting sales and profit margins through a wide range of selling conditions. That's why growth-focused investors will prefer to own this industry leader right now. It's possible that the stock will become cheaper, of course. But having P&G in your portfolio is likely to help you generate good returns no matter which way economic growth trends swing over the short term.