Yousufzais came 'back' to Peshawar area in the early 15th century along with some Durranis/Abdalis. Ahmed Shah, who came much later, distinguished them from Kandahari Durranis by giving them the title of 'Bur' or upper Durranis. I hope you get my point now.
As for their earlier migration to Afghanistan from coterminous Pakistan, they were forced to leave their original home because of the forced entry of Sychtic tribes in the region in the 5th/6th century. They then settled on the banks of river Helmand and founded a city which they named 'Gandhar' after their native capital, which is now called 'Kandahar'.
The original Afghans of Ghor moved into the Kandahar country around eighth century where the Gandharis were settled. The Afghans adopted the language of Gandharis and the Buddhist Gandharis adopted the religion of Afghans i.e. Islam. They lived together for centuries, intermarried and fused together into a common nation although retaining some level of distinct identities. Yousufzais are the descendants of those Gandharis.
And as for Sadozai Pathans, they are of Usmanzai descent and are closely related to Yousufzais. Sadozai Afghans (Popalzai) are a different group. They gave Shahs to Kandahar. And Barakzai Afghans gave Emirs to Kabul. Popalzais, Barakzais, Alikozais etc. are Zirak Abdalis (or Durranis). Ghilzais/Khiljis are an entirely different nation/group of tribeOTE]