Alphabet (NASDAQ:GOOG) (NASDAQ:GOOGL) and Facebook (NASDAQ:FB) are two of the most valuable companies in the world.

Born in the digital age, these two businesses now regularly generate huge profits for one reason: advertising. Alphabet's Google dominates search, while Facebook is the clear leader in social media. Both companies provide tremendous value for advertisers, which has essentially given them a duopoly in the industry, with fat profit margins to boot.

While these two tech giants are perceived as growth stocks, advertising isn't a limitless growth market. Overall, advertising is growing by just 4%-5% a year in the U.S., meaning that these two business can't grow at their current rates forever just on advertising alone. In fact, cracks in Google and Facebook's growth may already be showing.

Both Alphabet and Facebook stocks fell following their recent earnings reports on concerns about slowing growth. Facebook posted its slowest revenue growth rate ever at 25% in its most recent quarter. That's still much higher than the growth of the average company, but shows that the social network is starting to mature. Alphabet, meanwhile, saw its advertising business grow just 17% in the quarter, and 16% for the full year, showing that its days as a growth stock may be numbered.

Total digital ad spending was expected to top traditional ad spending last year, according to eMarketer, and by 2023 will account for more than two-thirds of total ad spending in the U.S. As digital takes up a larger portion of advertisers' total budgets, growth will be harder for Facebook and Google to achieve as overall growth in digital advertising slows. Additionally, challengers like Amazon, Snap, Twitter, and Pinterest are gaining market share, while eMarketer predicted that Google and Facebook would lose market share in 2019.

What's next for this advertising duopoly?

Alphabet and Facebook seem well aware of this threat. That's why they've made broad efforts to diversify into other businesses.

Alphabet renamed itself from Google in 2015 to signal to investors that the company is more than just Google and its brands. In addition to search, Google has built businesses like hardware, including the Chromebook computer and Pixel smartphone; the Google Cloud software-as-a-service cloud provider; and the company's Other Bets division, which notably includes its Waymo autonomous vehicle division, as well as plays in healthcare and drones. Though that division is losing money, with a $2 billion operating loss in 2019 on $659 million in revenue, it's making investments in a wide range of areas that could have significant returns down the road.

Facebook hasn't done as much as Alphabet to branch out from its core advertising business, but the company is still working to add other revenue streams. Its acquisition of Oculus gives it a strong position in virtual reality, one that CEO Mark Zuckerberg touted on the recent earnings call, and the company has also introduced its own hardware with the Portal smart video interface. Meanwhile, Facebook is building out other ways of leveraging its massive network with products like payments, Facebook Dating, Watch, and Marketplace. In 2019, $1.04 billion of Facebook's $70.7 billion in total revenue came from the "other" category, which is primarily hardware like Oculus and Portal, along with fees from developers using its payments infrastructure.

Investors should also remember that Alphabet and Facebook both have massive cash hoards on their balance sheets at $109.1 billion and $54.8 billion, respectively, and they haven't been shy about acquisitions in the past. So the potential for an M&A deal to boost their non-advertising businesses is also there.

Should investors be worried?

The transition to a mature advertising business is a long one, and will likely play out for both companies over the next decade. However, the good news is that this risk already seems largely priced in. Facebook trades at a P/E ratio of 24.2 today, which is essentially equal to the S&P 500, while Alphabet is valued at a P/E of 30.8, which is only slightly higher. But both stocks still look undervalued considering their current growth rates and competitive advantages.

Over the next several years, however, advertising will almost certainly play a less important role in the growth potential of both stocks. Investors should, therefore, keep an eye on each company's initiatives beyond advertising, as that may best shape their strengths and growth rates a decade from now.

This article originally appeared in the Motley Fool.

Jeremy Bowman owns shares of Amazon and Facebook. The Motley Fool owns shares of and recommends Alphabet (A shares), Alphabet (C shares), Amazon, Facebook, Pinterest, and Twitter. The Motley Fool has a disclosure policy.

In this file photo taken on January 18, 2019 a logo is pictured above the entrance to the offices of Google in London In this file photo taken on January 18, 2019 a logo is pictured above the entrance to the offices of Google in London Photo: AFP / Ben STANSALL