Many of Hanoi's attractions are within walking distance, but for locations farther apart, consider using a taxi or ride-sharing service such as Grab or Be. Taxis are readily available and fairly inexpensive, while Grab and Be offer competitive rates and allow you to pay using a mobile app. Beware of traffic during rush hour though, as it can cause delays.
If you have more time, consider adding a day trip to the nearby Ninh Binh province to visit the Trang An Landscape Complex for its scenic boat rides or the Cuc Phuong National Park for its trails and wildlife. If you have less time, consider skipping the Ho Chi Minh Museum or the Hanoi Opera House.