Having a multiyear time horizon can be one of your biggest advantages as an investor. While Wall Street is consumed with the inevitable shifts in outlook about what will take place during the next few quarters, long-term investors can tune out that noise and look toward future years. That's where the biggest returns accrue, anyway.

Dividend-focused investors have another reason to keep their eyes on the long term. Reinvesting dividends over the years allows you to accumulate more shares of the companies you own, amplifying your returns. And that compounding effect can really become impressive when your holding period stretches into the decades.

With that in mind, let's look at two excellent contenders for long-term income growth: Procter & Gamble (PG -0.78%) and Walmart (WMT -0.08%). Both are stocks you can buy with an eye toward being a shareholder for 20 years or more.

1. Procter & Gamble

Procter & Gamble has one of the longest streaks of annual dividend raises in the entire stock market. The consumer staples giant has been paying dividends for over 130 years, and hiking its payouts annually for nearly 70 consecutive years. That's nearly two decades longer than the threshold required to make it a Dividend King.

Its most recent earnings report showed off some of the competitive assets that have served it so well over the years. For its fiscal 2024 first quarter, which ended Sept. 30, P&G reported 7% organic sales growth year over year. This boost was powered mostly by the company's price hikes, but its year-over-year sales volumes only declined 1% overall.

The earnings outlook is brightening as inflation pressures ease. Management now expects a roughly $800 million boost to earnings this year from raw material costs, in fact, while it was bracing for a $200 million headwind from these costs just a few months ago. But income investors will be as excited to see P&G's gushing cash flow, which ultimately powers that rising dividend, currently yielding 2.5%. Thanks to its industry-leading efficiency, P&G aims to send about $15 billion to shareholders this year, including $9 billion in dividend payments. With a 59% payout ratio, P&G still has plenty of room to continue raising its dividend in the coming years.

2. Walmart

As the world's biggest retailer, Walmart needs no introduction. But you might be less aware of its attractive potential as a dividend stock. When the chain last reported quarterly results, it displayed accelerating growth as comparable-store sales jumped 6% in its core U.S. market. Shoppers are frequenting its aisles more often as they look to stretch their budgets. Customer traffic was up 3% year over year last quarter, a period during which many other national retailers, including Target and Home Depot, saw declines.

Sure, Walmart likely won't thrill shareholders with double-digit percentage sales growth in any given year. Its modest operating profit margin of around 3% of sales isn't nearly what you might see from a tech stock like Microsoft, either. But reinvesting dividends over the next few decades is your surest path toward positive returns that don't come with lots of risk. And Walmart has an excellent shot at delivering steady capital appreciation as well, as the company capitalizes on its massive global sales footprint.

Walmart's current 1.4% dividend yield is admittedly somewhat underwhelming. Part of the reason for it being low at the moment is the stock's 14.3% price appreciation so far in 2023. But its 43% payout ratio suggests there is still plenty of room for the dividend to keep growing over the years.

There's no telling what the retailing world will look like in a few decades, but it is likely that Walmart will remain a central player in the industry at that time. Income investors could benefit from that predictable success simply by holding this dividend stock over the long term.