Kim, where the ships are tied up is nowhere near the center of either city. And it's a long bus ride because of the traffic. When we were at the Hermitage, they arranged for people who wanted to stay longer to sign up for another hour and a bus would be sent back for them. However, it took so long (hours!) for the rest of us to get back that different bus had to be sent. My bus was the second to arrive back at the ship, and that was about three hours.
I believe there are subway stops close by, and that would be the fastest way.
There was a lot of time after seeing St. Basil's for people to look at the department store across the street, so you could spend that time in the church.
Because of different flight schedules on the return, some of us weren't leaving St. Petersburg until the afternoon. But we had to be off the ship early, so they could get things ready for the next group. They bussed us into the center of town, parked the bus in an area close to the river and churches, and turned us loose. The bus stayed there with the driver, so we could board as we wished. There was a very nice gift shop with really good bathrooms across the street. The gift shop people don't mind tourists coming in to use the bathrooms, because we stay and browse and buy. At least, that's what we were told.