From editor v4.0.2.stable.mono.official [7a0977ce2]
The ray casting documentation at
https://docs.godotengine.org/en/stable/tutorials/physics/ray-casting.html for version 4 stable
Includes the following code snipit
func _physics_process(delta):
var space_rid = get_world_2d().space
var space_state = Physics2DServer.space_get_direct_state(space_rid)
Physics2DServer appears to have been renamed to PhysicsServer2D. You might want to do a quick pass to see if any of this still works.
All the other places where they renamed stuff seems to have worked.