The UK will work together with Pakistan on matters of shared concern, including providing humanitarian support to the people of Afghanistan and preventing the war-torn country from becoming a place where terrorism flourishes, a British official said.