On a recent evening beneath the tower of Mission High School, there was plenty of tension and lots of yelling surrounding the District 11 state Senate race.

Volunteers in red T-shirts ringed the steps outside the school where Supervisor Jane Kim was holding a packed town hall meeting, waving signs in support. Several feet away, supporters of her opponent, Supervisor Scott Wiener, crowded the sidewalk next to a red tent they had pitched — a jab at Kim’s tolerance of homeless tent camps.

For nearly an hour, the steps became the battle line for a local race that has grown increasingly aggressive. Wiener criticizes Kim for what he calls her spotty record on creating affordable housing, prioritizing renters and protecting the LGBT community. She says his increasingly negative campaign is funded with corporate cash from big donors such as Airbnb.

“Facts are facts,” a Wiener supporter said, pushing a flyer about affordable housing into the hands of Noelle Duong, a volunteer for Kim’s campaign.

“Attacks are not facts,” Duong said, dropping the leaflet on the ground. “I don’t want that garbage.”

Wiener and Kim are in a dead heat to fill termed-out Sen. Mark Leno’s seat representing San Francisco and northern San Mateo County in the state Legislature’s upper house. Wiener, who has more prominent endorsements and money, was expected to beat Kim by double digits in the June primary. But Kim, who was endorsed by Sen. Bernie Sanders of Vermont during his Democratic presidential primary run, won by 669 votes, or a 0.2 percent margin.

As of Sept. 24, Wiener still had $363,000 left in his campaign treasury, compared with $207,000 for Kim. Outside donors are also pouring money into the election in the form of independent expenditures for or against the candidates.

The contest has shaped up to be the most contentious citywide election since now-Lt. Gov. Gavin Newsom beat Matt Gonzalez for mayor in 2003, said political consultant Jim Ross, who isn’t affiliated with either campaign.

“It’s the first contested election we’ve had since 2003,” Ross said. “You have to play every neighborhood and every district, from the Richmond to Visitacion Valley and San Mateo. Each neighborhood could be determinative of this race.”

Kim — personable and well-recognized for the signature red coat she wore in a campaign video showing her practicing tae kwon do last spring — has run on a platform centered on protecting middle- and low-income residents and expanding affordable housing. She has hosted a series of highly visible town halls across the city to discuss issues such as lowering the cost of higher education and improving regional transportation. She calls herself a fighter and uses the word at nearly every debate and appearance, and in her advertisements.

Born in Manhattan to affluent South Korean immigrants, she earned degrees from Stanford and the UC Berkeley School of Law. She was later elected to the San Francisco Board of Education and now represents supervisorial District Six, which includes South of Market and the Tenderloin, neighborhoods with a big share of new development.

“Everyone is struggling to stay in the Bay Area,” Kim said. “We have thousands of tenants fighting evictions today, and small businesses seeing their rents double or triple. The question is increasingly becoming, ‘Who is this city being built for?’ I have spent the past six years fighting for our city.”

Kim’s campaign has relied heavily on online marketing, creating Facebook events for her town halls and targeting voters with advertisements rather than posting a slew of mailers. But some have accused her of focusing more on style than substance.

The more mild-mannered Wiener is known as a relentless worker and policy wonk who has championed causes for the LGBT community. When running for District Eight, which includes the Castro, Upper Market, Duboce Triangle and Noe Valley, he famously walked every precinct in the district three times. He likes to send text messages to city officials in the wee hours of the night.

He was raised in Philadelphia, where his parents ran an optometry office. He studied at Duke and Harvard Law School. After moving to San Francisco to work as an attorney, he served as chairman of the San Francisco Democratic County Central Committee before being elected to the Board of Supervisors. His state Senate platform encompasses everything from protecting the environment to expanding health care and increasing funding for public transportation. Wiener has worked on myriad issues — at least seven topic pages are listed on his campaign website, with even more subcategories nestled below.

“I don’t need to hold a town hall to work with people to improve housing policy and public transportation,” he said. “I’ve been doing that work and having that dialogue for the past six years. I don’t just talk about doing the work — I actually do it.”

But voters could have trouble separating the two Democrats on any one issue. Wiener’s campaign has made the delineation by repeatedly marketing him as a hard worker and effective leader who would work across the aisle in Sacramento. In a recent video, dancers sing “Scott Does the Work” to the tune of a Katy Perry pop song. And Kim continues to go after developers for increasing affordable housing, cementing her campaign message of being a fighter.

As similar as the two supervisors, who both joined the board in 2010, might seem, they do differ on key issues.

Kim, considered a progressive, and Wiener, a moderate, have supported vastly different legislation. Kim has criticized Mayor Ed Lee’s sweeps of homeless tent camps and the city’s efforts to host the Super Bowl, while Wiener has spoken out against the camps and supported last year’s football extravaganza.

Wiener also backs corporate shuttle buses and wants police to be equipped with electronic stun guns, while Kim wants to limit the buses and is against the devices.

Lizzie Johnson is a San Francisco Chronicle staff writer. Email: ljohnson@sfchronicle.com Twitter: @LizzieJohnsonnn