When in doubt, check the docs for the methods you're using.
Physics2D.Raycast takes an origin position and a direction, but you're passing it an origin and a destination
If you want to check 0.5 units up on the y axis, try...
Physics2D.Raycast(
transform.position,
Vector2.up,
0.5f
);