I think that they key difference is urban vs rural environments. Walls are effective in urban environments to focus the movement of people into checkpoints - in Sadr City or El Paso.
A difference is that along the non-urban sections of the US-Mexico border, a wall needs to prevent individual persons from crossing. In Baghdad, the reason for division was to prevent large munitions, vehicle borne IEDs, and scattered gunfire.
In summary, walls can be effective, and they exist where needed along the US-Mexico border. A grand, glorious, wall in the middle of nowhere will not be helpful.
A difference is that along the non-urban sections of the US-Mexico border, a wall needs to prevent individual persons from crossing. In Baghdad, the reason for division was to prevent large munitions, vehicle borne IEDs, and scattered gunfire.
In summary, walls can be effective, and they exist where needed along the US-Mexico border. A grand, glorious, wall in the middle of nowhere will not be helpful.