A van driver who killed a three-year-old girl in a crash had taken "at least 20 lines of cocaine", a court has heard.