AI in Cybersecurity: Safeguarding Against Modern Threats