A Justice Department investigation would put Google—and potentially other tech giants—in an unwanted spotlight at a time when major internet companies already have seen their political fortunes turning, both in the U.S. and overseas.

The shift has come with multibillion-dollar antitrust fines for Google from the European Union. Facebook Inc. has come under intense fire over Russian use of its platform to meddle in the 2016 election. Policy makers also are increasingly skeptical of internet companies’ privacy practices, as well as their potential to create other public harm.

Alphabet, Google’s parent, typically is ranked among the world’s five largest firms by market capitalization, nourished by its powerful position in online advertising, a lucrative market that threatens to eclipse other forms of advertising. Along with Facebook, it has become a major player in the complex market. But other firms—notably Amazon.com Inc. —also have begun to compete for the business, raising competitive concerns for Google.