MI5 and MI6 are both intelligence agencies of the UK government, but there is a crucial difference.
MI5 is responsible for protecting UK citizens and interests at home, notably against threats to national security. By contrast, MI6 (also referred to as the Secret Intelligence Service) is responsible for gathering intelligence outside the UK in support of the government’s foreign and defence policies.