The Justice Department on Wednesday urged Congress to adopt new legislation that would punish Facebook, Google and Twitter for a wide array of harmful content posted online, threatening to erode a long-cherished legal immunity that Silicon Valley says is critical to the future of the internet.