In general, if there is an air gap of 3-5 mm it is not a problem, but this must be considered when calculating the magnet.