Hi,
You can zip files and mask such that you apply the same shuffling.
I = os.listdir('D:/Neda/Pytorch/U-net/my_data/imagesResized')
M = os.listdir(path_to_masks)
pair_MI = zip(I,M)
random.shuffle(pair_MI)

WRT splitting dataset, I see you are using U-Net, thus I assume you are segmenting something in medical images.
Do you have several classes? Do you have a single one?
If you have several classes you have to try to ensure that your validation and split set contains the same proportion of samples than the training (even if this condition is not always satisfied). You should ensure that images from one patient don’t belong to training and val/test set, as they may be similar and wouldn’t be a proper validation set.
In short, create a val/test set with patients never seen in the training set. As far as I know, in medical imaging results may overfit to the machines data was acquired with. If you data comes from several machines try also to shuffle it.
Regards
Juan