As you get close to the end of your working days, you will probably shift your investment focus. After all, you were probably focused on wealth creation, and now you need to change your outlook to preserving that sum of money and creating income.

With that in mind, companies that have strong market positions, produce a lot of free cash flow, and pay ever-higher dividends fit these criteria. Let's take a closer look at two companies that appear to fit the bill.

Two seniors sitting on a couch.

Image source: Getty Images.

Walmart

While the retail industry is notoriously fickle, leaving many by the wayside, Walmart (NYSE:WMT) has thrived over the past six decades. Serving more than 240 million customers weekly, it has done well by keeping a lid on costs and passing these savings to customers via low prices. 

Fortunately, management hasn't rested on its heels. Since starting its first e-commerce sites more than two decades ago, it continues to push technology and omnichannel initiatives. A year ago, the company launched Walmart+, its subscription service that includes shipping, a faster checkout, and discounted gas prices.

This simple business -- providing ultra-low prices along with quick and convenient delivery options -- produces a prodigious amount of free cash flow. For the first three quarters of this fiscal year, it generated $7.7 billion, which easily covered the $4.6 billion of dividends. This was for the period that ended on Oct. 31.

The dividend is also very important to Walmart. After declaring its first payment in 1974, the board of directors has subsequently increased the dividend every year since then. Already a Dividend Aristocrat, the company is on the cusp of becoming a Dividend King in a few years.

Microsoft

Over Microsoft's (NASDAQ:MSFT) more than 45-year history, it has become well known for its Office and Windows products, plus its Xbox gaming system. The professional networking company LinkedIn is also under its umbrella.

These products, plus cloud computing and artificial intelligence, keep growing nicely. Far from being a stale, mature company, its fiscal first-quarter revenue grew by 22% to $45.3 billion. This period ended on Sept. 30.

Fortunately, Microsoft also produces a lot of free cash flow. Last year, it generated over $56 billion, easily covering the $16.5 billion of dividends. Although the company hasn't built as impressive a dividend history as Walmart, it has increased payouts every year since 2006.

Microsoft, with its strong market position and eye toward the future, figures to stay on top of its game for a long time.

As you close in on the end of your working days, you can celebrate this milestone. After that, you'll want to look at your investments to make sure they align with your investment objectives. You can feel confident that Walmart and Microsoft, two dominant companies in their respective sectors, will provide stability and income during your retirement years.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.