Social media firms like Instagram and TikTok will have to make changes to comply with new online safety laws.