OTH for Northerners, blacks were exotic creatures that segregating in the Army made sense.
Both armies used thousands of African-Americans in nearly every possible job.
One difference is the Union Army paid its workers, while the Confederate army paid their "owners".
Another is that Union black workers were declared free and could leave their jobs whenever.
Confederate slaves, not so much.
As for segregated Union regiments, it's true and some were used for less critical guard duties.
Others earned a fearsome reputation in combat and suffered much higher casualties for it.
Black Union soldiers performed so well many were kept on after the war as Buffalo Soldiers out West, and it's said, one even rode into mythology as the Lone Ranger.
Hiho Silver, away!