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.505 units up on the y axis, try...
float rayDistance = 0.05f;
Physics2D.Raycast(
transform.position,
Vector2.up,
0.5frayDistance
);