Britain will allow Huawei Technologies a restricted role in building parts of its 5G network, seeking a middle way in a bitter dispute between the United States and China over the next generation of communications technology.