Can AND do raycasts work like this?

no, i dont think so.

from my knowledge, raycast go from one point to another and u can utilise that to detect if in the way going from point A to B it hit something