The filmmaker Spike Lee, a longtime New York booster, said he worries about the city becoming more expensive and less accessible to people of color in particular, who have contributed so much to the city’s culture, from the birth of hip hop in the South Bronx to artists like Alvin Ailey and Jean-Michel Basquiat.

“It’s is really sad because the reality is New York City is not affordable anymore,” Mr. Lee said. And if Black people can’t afford to live in the city, “you could seriously say New York City isn’t the greatest city in the world,” he said.

Eric Adams, New York’s second Black mayor, has vowed to create a more affordable city to stem the “hemorrhaging of Black and brown families.” Mr. Adams’s own bid for mayor was partially built on a biography that reflects the Black community’s roots in the city: His parents traveled north from Alabama during the Great Migration, climbed their way from poverty in Brooklyn to middle-class homeownership in Queens and relied on public schools and colleges to lift their children to greater success.

Younger Black families say that trajectory has become more elusive. High inflation and a turbulent rental market as the pandemic has subsided have hurt New Yorkers across the board. But Black families lag far behind white families in homeownership and in building wealth. Black households have a median income of $53,000, compared with roughly $98,000 for white households, according to the most recent census data.

Ruth Horry, a Black mother who bounced through cockroach- and rodent-infested Brooklyn apartments for years, has repeatedly been priced out by rising rents. Eventually, Ms. Horry, 36, and her three daughters, landed in the shelter system. At a shelter in Queens, the sink was so small Ms. Horry washed her children’s hair in the bathroom at a nearby McDonald’s.

“The conditions for what you could afford were mind-blowing,” she said. “I was just so tired of that.”

In late 2019, Ms. Horry moved to Jersey City through a New York City voucher program, known as the Special One-Time Assistance program, which relocates vulnerable families into permanent housing with a full year’s rent upfront. The drop in living costs has been life-changing, Ms. Horry said, and she is considering moving to the South to save even more.