The incident took place at Bhagwanpur in Roorkie. People from nearby villages rescued those trapped inside the mangled bus.
The bus was on its way from Saharanpur in Uttar Pradesh to Haridwar in Uttarakhand.
The bus driver, Raj Kumar, suddenly had a fit and could not control the vehicle. To avoid a major mishap, he rammed it into a roadside tree on the Delhi-Dehradun highway.
Police officer Bhagwan Meher said 22 of the injured were being treated at a government hospital while some others were admitted in private clinics.
The injured passengers were mostly from Haryana, Jammu and Uttar Pradesh.