The new safety feature comes as social media platforms face growing legal pressure over how they affect minors.