The UK has pledged to spend £600m to defend the public against threats to health and security from artificial intelligence.