A teenager was dragged from a taxi and stabbed to death by a rival drugs gang in a “barbaric” assault, a court had heard.