SAN FRANCISCO — Last spring, Carlo Gascon’s organization took a chance on this city’s extraordinary technology boom, paying $1.4 million to turn a rundown single-family structure in the troubled Mid-Market area into its headquarters.

His neighbors are still an issue.

“Tech people — they see a bunch of kids hanging out in front of the recreation center, they call the police,” said Mr. Gascon, a 29-year-old lifelong neighborhood resident. “They don’t know; you live with 10 or 12 people in one apartment, you want to be outdoors until you sleep.”

Mr. Gascon belongs to United Playaz, an organization in which former gang members try to keep young people from turning to crime. Now, he and others on both sides of this starkly divided district are searching for some level of coexistence.

Four years ago, tech companies like Twitter entered San Francisco’s Mid-Market, an area that includes the Tenderloin and South of Market, or SoMa, neighborhoods. As an incentive, these companies were given tax breaks, which are still in effect, on payroll and stock options. As a result, thousands of wealthy and educated young workers began working, and living, in one of San Francisco’s poorest and most densely populated areas.