Samarqand is a city in southern Uzbekistan.
North towards Toshkent
The easiest is to take a taxi from Registan, say you want to go to Toshkent shared taxi point (arround 10 km). It should be around 3000 sum (1,5 dollar). From here you walk 500 meters to get away from all the taxis who want you to come with them, and start hitching. Be awear that after 5-10 km you come to a roundabout, the road to Toshkent goes to the left/you kind of have to make a u-turn, if you stay on the highway you end up going a different way. So if you don't reach this roundabout after 30 min, get of and turn around.
There is a bus station at the end of Registan street (a bit further, after the last crossroads actually). Take a minibus to the border control point 30 km away from the city to avoid losing a lot of time with short local rides.
N.B. Border control point to Panjakent is closed for foreiners since 2011.
West towards Bukhara
Take bus 35 to the final stop. You will be at the roundabout where the road going out of town converges with the ringroad. Therefore you will be able to catch long distance trucks going around Samarqand. Hitch-hike just past the roundabout.