Sites including Instagram, YouTube and TikTok will become inaccessible for millions of children, the prime minister has announced.