When it comes to finding companies to hold for the long term, investors need to take a cautious approach. Thinking about investments that can hold up for decades is way different than thinking in terms of days, weeks, and quarters. You need to ensure that you are buying companies that have what it takes to survive good times and bad.

Consumer products icons Procter & Gamble (PG -0.74%) and Colgate-Palmolive (CL 1.11%) both measure up when it comes to a long-term investing standard and could be good additions to just about any portfolio. Here's a quick look at some of the key factors that make each worth holding for the next two decades.

Grocery store cashier and bagger checking out customer.

Image source: Getty Images.

A history of dividends and dividend increases

Procter & Gamble has increased its dividend annually for 66 consecutive years. Colgate-Palmolive has done the same for 59 consecutive years. They are both Dividend Kings. Companies don't achieve streaks like these by accident -- they have to be consistently well run. Procter & Gamble's dividend yield is currently 2.3%, while Colgate-Palmolive's yield comes in at 2.45%. Although those aren't huge numbers, they are still fairly generous compared to the S&P 500 Index's average yield of just 1.3% or so. 

To be fair, neither Procter & Gamble nor Colgate-Palmolive stock look particularly cheap today. But if you are looking for a reliable income stock to hold over the long term, paying up for quality is probably not such a bad plan. 

Both companies produce things people need

The reason for the consistency here is that both companies sell consumer staples like toothpaste and paper goods, among many other things. People buy staples in good markets and bad ones, so there's an inherent resilience to the business.

Meanwhile, both companies are industry heavyweights, with Procter & Gamble sporting a massive market cap of $370 billion and Colgate-Palmolive a smaller, but still sizable, $64 billion. This scale provides them with the ability to invest in their brands, advertise heavily, and negotiate from a position of strength with retailers. Put simply, consumers want and need the products they sell and so, too, do retailers.

These companies know how to deal with inflation

One of the big problems today for companies like Procter & Gamble and Colgate-Palmolive is inflation. They are facing increased costs for the inputs they need to make their products, the staff they need to produce them, and transporting finished goods to market. Only inflation isn't a new phenomenon. Both companies are used to finding ways to pass costs on to customers over time.

The difficulty is that the process is a delicate one and it simply takes some time, so margins are likely to be weak in the near term while this process unfolds. As an investor, you just have to remember that these two industry giants have been here before.

Both companies are doing well right now

That brings the story to recent results. Procter & Gamble, while warning that consumers will eventually start to push back, has been doing a phenomenal job of increasing prices. Notably, in the company's fiscal 2022 third quarter (ended March 31), it was able to increase prices by 5% while, at the same time, increasing volume by 3%. Consumers even shifted toward higher-priced items in the company's product portfolio, leading to organic sales growth of 10% in the quarter. That's a very strong number that's probably not likely to be repeated, but it shows just how well Procter & Gamble is doing right now.

Colgate-Palmolive's results aren't nearly as good, but they are hardly bad. For example, organic sales increased 4% for the company in the first quarter of 2022. However, that was all from increasing prices, which totaled 5.5%. Organic sales fell 1.5%, as consumers pushed back on the price hikes. Still, getting its rising costs covered is the right move and helps protect its ability to grow its dividend over time. And, to be fair, this is the more typical path for a consumer goods company when inflation is raging. Procter & Gamble is really doing extraordinarily well right now.

The long term

The key for both Procter & Gamble and Colgate-Palmolive is that they have proven over time that they can weather tough conditions. They are doing so again right now, with one doing better than the other. But both are really managing fairly well while ensuring their ability to keep rewarding investors with solid dividends. They are the kinds of businesses you can buy and hold for the long term, no matter what's going on in the broader market.