The SF Marriott is probably the most convenient to the Castro. You can take the Muni Metro K, L or M lines to Castro station, or you can take the street car to 17th @ Castro. If you want to take a cab, the fare is about $6.50... You wouldn't really want to walk between the Castro and Union Square. Some of that area is ROUGH.
There are really no decent hotels within walking distance of the Castro.