Often the UNet implementation might be a bit flexible when it comes to different input shapes.
Usually resolutions using powers of 2 work the best, as the conv and pooling kernels are often adapted to these shapes.
However, if your input shapes vary a lot, you could try to use adaptive pooling layers, which will yield a specified output shape, or manually pad/crop the activations to the desired shapes.