Danson will play a wealthy businessman who unexpectedly becomes the mayor of Los Angeles.
Fey and Carlock previously worked together on the Netflix sitcom Unbreakable Kimmy Schmidt, which recently wrapped its fourth and final season. An interactive special is expected to stream next year.
Before Kimmy, Fey and Carlock together produced the NBC sitcom 30 Rock, in which Fey starred.
NBC recently confirmed it canceled Danson's latest show, The Good Place, after four seasons.
"We are thrilled to be back home at NBC and writing for one of the network's greatest stars of all time, Mary Steenburgen's husband, Ted," Fey and Carlock joked in a press release.