You can do it both ways. The only limit is that the backup can only be restored to a device that is running either the same or newer version of iOS than the one the device was running when the backup was taken. So if you backup iOS 11 device, you can restore that backup to other iOS 11 (and eventually 12, 13...) device.