You are incorrect. Laws may both explicitly (or otherwise intentionally) target race and may disproportionately impact race without explicit targeting.
Laws doing the former are subject to “strict scrutiny”: the discrimination must be the least invasive means of achieving a compelling government interest. The latter isn't prohibited at all, though it can be evidence of discriminatory intent. (You may be thinking of employment law, where disparate impact is generally prohibited discrimination, unless closely tailored to a specific legitimate non-discriminatory business need.)
See https://en.m.wikipedia.org/wiki/Equal_Protection_Clause for a discussion, especially the section under “tiered scrutiny” and “disparate impact”.