First of all, I am not sure if you are asking how to switch cameras in general. Assuming you know how to do that, and you are asking how to know which camera is the closest one, one way would be to add all the cameras to a group, lets say “cameras”, and then iterate looking for the closest one like this: (pseudo-code, since I dont recall exactly how certain methods are written):

var closest_distance = 0
var closest_camera
for camera in get_nodes_in_group("cameras"):
var distance = self.position.distance_to(camera.position)
if closest_distance == 0:
closest_distance = distance
closest_camera = camera
if distance < closest_distance:
closest_distance = distance
closest_camera = camera