When the markets get volatile, it's nice to have stocks that continue to pay some cash into your brokerage account. While it's not the end-all indicator of a company's staying power, a company that has consistently raised its dividend for decades is likely one that possesses a durable competitive advantage that allows it to grow its revenue and profits over time.

Here are two stocks that have delivered a good balance of capital appreciation and rising dividend payments for more than 25 years.

A roll of hundred-dollar bills sitting next to a sign that reads dividends on a wooden table.

Image source: Getty Images.

1. Walmart

Walmart (WMT 0.23%) currently pays a dividend yield of 1.72%. That's below the S&P 500 average of 1.96%, but Walmart has maintained a streak of dividend increases every year since 1974. That makes it a Dividend Aristocrat. Most importantly, the company has a payout ratio of 40%, leaving plenty of room to increase the dividend.

Plus, the retail giant is seeing huge momentum right now in its burgeoning e-commerce business. More than 265 million people visit a Walmart or Sam's Club store every week, including Walmart's e-commerce websites across 27 countries.

The COVID-19 pandemic significantly increased order volume at stores in the fiscal first quarter. Walmart reported a 10% increase in comparable-store sales, as customers made fewer trips but purchased more with each transaction.

Walmart was well-positioned as a go-to destination for customers due to its investments to build up its e-commerce operation in recent years. As of January, Walmart had more than 3,000 grocery pickup locations and more than 1,600 delivery locations. In response to Amazon.com's push with one-day and same-day delivery, Walmart's vast infrastructure, including thousands of stores, allowed it to quickly respond with NextDay delivery for 75% of the U.S. population.

Walmart's total e-commerce sales in fiscal 2019 were $36.9 billion across Walmart and Sam's Club, which was less than 7% of Walmart's total revenue last year, but online sales are growing fast. E-commerce sales grew 35% in the fiscal fourth quarter, while the coronavirus crisis caused online sales to jump a whopping 74% year over year in the fiscal first quarter. The e-commerce business is humming along so well that management announced it was discontinuing its Jet.com business, which it acquired nearly four years ago to jump-start its online ambitions.

Walmart is a resilient retailer with a massive number of stores that serve as close contact points for much of the U.S. population. This will continue to be an important advantage as competition for online grocery delivery heats up.

2. Procter & Gamble

Even in a weak economy, people are still going to brush their teeth, shave, and clean their homes. Procter & Gamble (PG -0.12%) owns many household brands, such as Gillette, Tide, Pampers, Charmin, Old Spice, Crest, Oral-B, and Mr. Clean. The COVID-19 crisis caused an increased demand for many of P&G's products. In the quarter ending in March, P&G posted strong organic sales growth of 6% year over year -- a healthy number for a large consumer staples giant.

P&G has been around since 1837, and its current performance suggests it will be around for many more years. That could mean another century's worth of quarterly dividend payments. P&G has paid a dividend every year since 1890, and it has raised the dividend for 64 consecutive years -- a true Dividend King.

Like Walmart, P&G has had to adapt to shifting competitive landscapes to keep growing. In the last decade, management saw an underperforming business with too many brands. It decided to reduce the number of brands it produced to the best 10 categories, representing products that have the best growth prospects and profit margins. Organic sales growth has significantly improved from just 1% in fiscal 2015 to an average of 6% in recent quarters. The operating margin has been trending higher, too. In the last quarter, adjusted earnings per share climbed 10% year over year.

P&G currently pays a dividend yield of 2.67% and recently increased the quarterly dividend by 6%. It pays 56% of its free cash flow in dividends, providing a cushion to maintain and increase the dividend.

Walmart and P&G are not stocks to buy if you're looking to crush the market's return, but these stocks should remain solid income investments for many years.