Both are good. If you have a chance at either one, you're golden. Go where you will be happy, both will train you well.
Historically, UCSF has been the stronger research program. If your goals include becoming a research type, that would be the place for you. Christian Apfel of PONV fame has recently relocated to UCSF.
UCSF used to have the bigger rep for jobs in the Bay area. That was a legacy of the Bunker years early 1970s.
Questions I heard when looking for a gig: "You know you do have to be able to give a spinal in private practice, son. Can you give a spinal?"
I enjoyed my time at Stanford aka the 'farm.' Larson succeeded Bunker in 1974 or 75. Much better clinical training.
Housing in either place is absurdly expensive.
Good luck. I don't think either would be bad choices.
aghast1