2023 has not been a good year so far for Procter & Gamble (PG -0.78%) investors. The stock is down a little over 4% year to date, compared to a near 20% gain for the S&P 500. To be fair, the underperformance is expected. A stodgy dividend-paying stock like P&G is likely to underperform in a great market year, simply because epic years of outperformance are usually driven by growth stocks, not income and value securities.

On the flip side, P&G stands a good chance of outperforming the S&P 500 during a below-average year or a down year as we saw in 2022.

P&G is an excellent company that's being overlooked in favor of faster-growing, flashier names right now. But long-term investors know that times like this usually prove to be wise buying opportunities over the long run.

Here's why P&G is a top Dividend King to buy for 2024 and a better opportunity than another similar Dividend King -- Coca-Cola (KO).

A child smiles while riding on the back of an adult who is unloading laundry from the dryer.

Image source: Getty Images.

P&G serves a specific purpose

If you're investing in a stock like P&G, it's not because you're trying to beat the market in a certain year but because you view the company as a good value that will offer passive income for years. P&G has given investors every reason to count on it no matter what the market is doing.

The company is one of the longest-tenured Dividend Kings, having paid and raised its dividend for 67 consecutive years. Given the low-growth nature of its portfolio of consumer staples brands, P&G has limited options for efficient capital deployment within its business. Instead, it turns to buying back its own stock and raising its dividend, which makes the stock a better value for long-term investors.

P&G has proven its industry leadership

What has been particularly impressive about P&G over the last two years or so is its pricing power. P&G's sales volumes have taken a hit due to inflationary pressures. To combat these pressures, the company has turned to steep price increases across its product lines, which have been largely absorbed by customers.

In its recent quarter, P&G implemented a 7% average price increase across the board, which contributed all of the organic growth in the face of a 1% overall decline in volume. The company's ability to pass along higher costs to consumers is a testament to its brand power -- which sounds a little strange.

After all, is Tide detergent really that much better than the generic brand? But the results indicate that P&G has a secret sauce that's working.

2022 and 2023 provided a stress test for P&G, proving that the company can do well, even in an inflationary environment. It's already known that P&G does well in a recession, given its performance isn't closely correlated to the broader economy. So the fact it did well, given the recent circumstances, is a vote of confidence that the stock is worth buying and holding.

Worth the premium price

P&G's 23.6 price-to-earnings ratio and 2.6% dividend yield aren't eye-catching on the surface, especially for value investors or those interested in a high yield. But the company makes up for its premium valuation and decent yield with its reliability. After all, what good is a high yield if the capital losses outweigh the dividend income?

Over the last five years, P&G has given investors a solid total return (nearly as good as the S&P 500), while boosting its dividend by over 30% and reducing its share count by over 5%.

PG Dividend Chart

PG Dividend data by YCharts.

Over the years, P&G has proven that it isn't solely an income stream, unlike other stodgy dividend stocks that drastically underperform the market. But rather, P&G is likely to produce a blend of dividend income and capital gains over time.

Better than alternatives

Speaking of stodgy stocks that underperform the market, Coke is another well-known Dividend King with an equally impressive track record of dividend raises. But in terms of the business itself, P&G has done a far better job growing its earnings.

PG Shares Outstanding Chart

PG Shares Outstanding data by YCharts.

With both stocks sporting similar forward P/E ratios (P&G at 22.8 and Coke at 22.2), there's really no reason to choose Coke over P&G.

With P&G, you aren't just buying the stock for the passive income stream -- you're also getting a consistently low-growth business that can support future dividend raises.

Time to go on a buying spree for P&G

P&G has the makings of a foundational holding worth buying and owning no matter what. The company executes during difficult climates when many of its peers are struggling. Its margins have stayed strong throughout this inflationary period, thanks to the company's pricing power.

P&G trades at a slight premium to the S&P 500 but deserves it. Given the company's likely outperformance during a bear market, it can serve a particularly useful purpose in a portfolio that may be more correlated to the broader market.