I don't know how you are doing your pciking, but you can easily raycast to the ground by casting a ray with a collision mask which only matches the ground (snippet from my project):
func _physics_process():
var mpos = get_viewport().get_mouse_position()
var ray_pos = _camera.project_ray_origin(mpos)
var ray_dir = _camera.project_ray_normal(mpos)
var space_state = get_world().direct_space_state
var ground_only = # your mask here
var hit = space_state.intersect_ray(ray_pos, ray_pos + ray_dir * 200.0, [], ground_only)
if not hit.empty():
# Do stuff with the result
Then you could cache the result if you want to use it elsewhere.