Car bombs have hit several mostly Shia neighborhoods of Baghdad and a town south of the Iraqi capital, killing at least 24 people and wounding dozens, officials say.