Same distance betweet multiple objects
assuming that you want to create a vertical gap between objects, and their origins are in the center of geometry, you can use this script to do it, it aligns the objects and creates a vertical gab between them:

import bpy
#Change gab
gab = 1
objs = bpy.context.selected_objects
box = []
for i in range(len(objs)):
    objs[i].location = (0,0,0)
    box.append(objs[i].dimensions[2])
    if (i == 0):
        box[0] = box[0]/2
    else:
        objs[i].location[2] = (sum(box[:i])+objs[i].dimensions[2]/2)+gab*i