Investors have placed discounts on both Dollar General (DG -0.41%) and Ulta Beauty (ULTA -0.40%) stocks this year. That's not a surprise given that the retailers each recently described worsening selling conditions as they reduced their 2023 outlooks. As a result, the two stocks have been left out of the rally in the S&P 500 this year.

Yet both businesses are growing, profitable, and have a long runway for store expansion ahead. These positive factors suggest they could be good buys for patient investors aiming to take advantage of the current low sentiment around their short-term prospects.

But which one is the better buy?

The faster grower

Ulta Beauty comes out ahead in the growth matchup. Comparable-store sales this past quarter rose 9%, on top of an 18% spike a year ago. Dollar General's boost was 7%, or about even with the rate posted by Walmart in the first quarter.

Look closer and you'll see more evidence that the beauty products retailer has the stronger demand posture. Its customer traffic rose by a blazing 11% in Q1, whereas Dollar General posted a small traffic decline.

To be sure, demand trends are slowing for both businesses. Ulta Beauty said in late May that increased promotions from competitors forced it to cut prices to protect market share. And in early June, Dollar General said the selling environment has become "more challenging than expected," as people looked to reduce spending. Still, the retailer is expecting about 1% growth this year, while Ulta Beauty is expecting between 4% and 5% gains.

Profits and cash

It has been a challenge to protect profitability in the retailing industry, but these two companies stand out as winners on this score. While Target's (NYSE: TGT) operating margin was 5% this past quarter, Dollar General managed 8% profitability. That's the same rate the company achieved a year ago.

Chart showing Ulta Beauty's and Dollar General's operating margins beating Walmart's and Target's since 2021.

ULTA Operating Margin (TTM) data by YCharts

The profit picture is more complicated for Ulta Beauty. It is much more profitable with its 17% operating profit margin. Yet that rate is declining right now due to those pricing pressures. Profitability had reached 16% last year, but management is now calling for the metric to slip to less than 15% in 2023.

Price and value

The valuations for these stocks are sitting near their lows for the year, reflecting pessimism on Wall Street about the short-term growth picture. Investors are paying less than 1 times sales for Dollar General today, compared to the price-to-sales (P/S) ratio of 1.6 for much of the last three years. You'll get a discount for Ulta Beauty shares, too. Its P/S ratio is 2.2, down from over 3 during the high-growth phases of the pandemic.

Ulta Beauty still looks like the more attractive buy here, though. It is winning market share in the makeup industry and is far more profitable. Growth is still looking strong for 2023 on top of big gains in each of the past two years, too. And the stock is available at a discount that investors haven't seen too often in the last few years.

If you can hold shares through the volatility of the next few quarters, Ulta Beauty could deliver solid long-term returns once the next cyclical upturn begins in the makeup sector.