There are actually several versions of the Lefschetz hyperplane theorem for singular varieties. The main point is that this is ultimately a Hodge theoretic statement, one proof is using the Kodaira-Akizuki-Nakano vanishing theorem to establish the analogous statement for the Hodge components of singular cohomology.
Hartshorne proved that the usual statement holds if $X\setminus Y$ is smooth, in other words, if $Y$ contains the singular locus of $X$. See 4.3 of this paperthis paper.
With the development of a sensible Hodge theory for singular varieties this has been further generalized. I am not sure whom to attribute the credit for this. You can find a version for the case when $X$ is a local complete intersection in III.3.12(iii) of this volumethis volume.