We will start Early morning around 7 AM on 6th Day from Sankri and it takes about 8 hours to reach Dehradun considering ideal situations and lunch breaks. However it is advisable to keep buffer time of about 3 hours as it is mountainous road. So you are expected to reach Dehradun from Sankri at 3 PM and considering the Safe Buffer Time, you should book your return tickets only after 6 PM from Dehradun.
If you are travelling to Delhi from Dehradun, then you will get many buses that leave from ISBT. Its better if you pre-book, but thats not mandatory if you are not very particular about the bus service and quality. Usually they are good.