Physics2D.Raycast(localPos vs pos, Vector2.up) ?

Is there any difference what parameter we’re going to use for the position in Raycast? transform.localPosition or transform.position

Yes, it does matter when your transform.localPosition is not same as transform.position since your point of origin for Raycast will change with use of either of these.

The transform.localPosition gives the position of your object with respect to its parent whereas the transform.position is the world position of your object. So if your object has no parent game object then your transform.localPosition and transform.position will be the same.