The best way is taking overnight train from Hanoi to Sapa then connect with a road trip for 1 hour.
There are many people who try to ask you to buy bus tickets either outside or inside Lao Cai train station, you can accept their invitation, however, you should only paid when the bus really departs.
For a comfortable seat, it should be better to book the shuttle bus, you may not be pushing to seat with 15 people for a mini bus of 16 seater.