Buying and holding quality stocks is a safe way to build wealth over the years. It's certainly less risky than jumping on the latest bandwagon and buying a stock that's hyped. As long as you invest in businesses that are likely to continue growing over the years and have sound financials, you'll give yourself good odds for success.

Two stocks that can be great options for long-term investors are UnitedHealth Group (UNH 1.61%) and Alphabet (GOOG -1.10%). Both companies are coming off impressive quarterly results, and their strong performances will likely continue into the future.

A doctor looking at a tablet with another person.

Image source: Getty Images.

1. UnitedHealth

Health insurer UnitedHealth reported third-quarter results last month. Adjusted earnings per share (EPS) of $4.52 beat the $4.41 that analysts were expecting for the period ended Sept. 30. But earnings beats aren't uncommon for this healthcare giant; in each of the past four quarters, UnitedHealth's EPS came in better than Wall Street's estimates.

In Q3, the company said the impact of COVID-19 had diminished, thus helping the business generate $2.7 billion in operating earnings -- a 29% improvement from the prior-year period. UnitedHealth is also bumping up its guidance for the full year. It now expects adjusted EPS of $18.65 to $18.90 (up from its prior estimate of $18.30 to $18.80).

UnitedHealth has been evolving through acquisitions, and that's a key reason why I see it maintaining momentum and growing. Last year, it acquired DivvyDose for $300 million, a company that helps deliver and pre-sort medications for people, not unlike Amazon's PillPack. This year, it paid $7.8 billion in cash for Change Healthcare, which offers software to help healthcare companies manage their payments and also provides valuable analytics for decision-making.

These are just a couple of examples of ways in which UnitedHealth is diversifying its offerings and providing more value to customers. The company has generated free cash flow of at least $10 billion in each of the past four years. Continuing on that path could pave the way for even more deals in the future.

So not only is UnitedHealth a safe healthcare business to invest in, but it's also a growing one -- and that makes it an easy stock to justify putting in your portfolio.

2. Alphabet

Tech leviathan Alphabet is also coming off stellar performance in its most recent results. For the period ended Sept. 30, its EPS of $28 dwarfed analyst estimates of just $23. And revenue of $65 billion was also comfortably above the $63 billion that Wall Street was expecting.

What makes Alphabet a solid, long-term investment is that in addition to strong pillars such as YouTube and Google search in its portfolio, the company also has its cloud-based business, which contributed just under $5 billion in revenue in the latest quarter, up 45% over the year-ago period.

Alphabet also has an "Other Bets" segment, which allows the company to chase potential growth opportunities that may be long shots today but won't have a significant impact on its financials (e.g. self-driving cars or healthcare innovation). Although Other Bets contributed just $182 million in revenue in Q3, having an area focused on research and development is what's going to help keep Alphabet a dominant force in the tech sector as it uncovers new projects to pursue.

Given the strength of its core services -- which brought in $60 billion in sales and operating income of $24 billion in just this past quarter alone -- Alphabet can afford to set aside funds to pursue these long-term projects. That's why, despite trading near its 52-week high, Alphabet is still a solid stock to buy and hold.