While they both fall under DHS, you're confusing CBP with ICE.
CBP's job is to protect the border and stop drug and people trafficking entering, whereas ICE's original purpose was to enforce immigration law within the US.
While not "everything" ICE was tasked with was immigration, that was their bread and butter. Where the vast majority of their workforce and spend went.