While it is tempting to buy and sell stocks, if you are investing in dividend-paying stocks, holding the shares in these companies for a long time is the best option to build an income that you can use to invest, save, or spend. The trick is to pick the right stocks to buy and hold, however.

Granted, finding great dividend stocks that you can safely hold for decades isn't easy. Here are two large, stable companies that fit the bill, partly because they have not only paid dividends for decades but have raised the amount paid each year. Each is in a good position to continue doing so.

A sticky note with dividends written on it, surrounded by other items, including rolled-up bills.

Image source: Getty Images.

1. PepsiCo

PepsiCo (PEP -0.20%) sells its well-known soda, snacks, and food brands around the world. Most notably, this includes Pepsi drinks, but it also offers many other products such as Gatorade, Sabra, Frito-Lay, Cheetos, and Quaker Foods.

Last year, its adjusted revenue grew by better than 4%, and earnings per share were 2% higher. Revenue and earnings growth accelerated in the fourth quarter, and for 2021 management expects a mid-single-digit percentage increase in revenue and high single-digit percentage growth for earnings. These are in line with its long-term objectives.

Last year, the company generated $6.4 billion of free cash flow (FCF), which was plenty to pay its $5.5 billion of dividends. Management certainly feels good about PepsiCo's future, recently announcing that it was increasing the quarterly dividend by 5% from $1.02 per share to $1.08 starting in June. This makes 48 straight years with a raise, qualifying it as a Dividend Aristocrat -- an S&P 500 company that has raised its dividend payout yearly for at least 25 straight years -- and edging very close to becoming a Dividend King.

2. Target

Target (TGT -0.41%), whose forerunner was started nearly 120 years ago, seeks to stand out from other retailers through partnerships that allow it to offer merchandising exclusively at its stores and on its website.

It has also remained competitive by investing in technology, allowing consumers multiple ways to shop. Target also has various ways for them to quickly get their goods.

Appealing merchandise plus convenient ordering and delivery options are a powerful combination that consumers appreciate. Target's fiscal third-quarter same-store sales were up by 20.7% year over year, with more than half attributed to digital sales, while its adjusted earnings more than doubled to $2.79 a share. This period ended on Oct. 31, 2020.

Target also produces more than enough free cash flow to pay its dividends. For the first nine months of 2020, its FCF was $5 billion and it shelled out $1 billion in dividends.

Last June, when it announced a quarterly dividend increase from $0.66 a share to $0.68, the company had raised the payment for 49 straight years.

Long track records of rising dividend payouts

Clearly, not only paying dividends but regularly increasing them is important to PepsiCo and Target. It isn't just their track records that give me confidence. With both companies holding strong market positions and bringing in a lot of cash, these are companies you can confidently hold for a very long time with some real assurance of collecting ever-higher dividend payments.