If you're using release R2019a or later, specify the 'linear' option to obtain linear indices from max and use those linear indices directly to index into the other array of the same size.
x = reshape(randperm(27), [3 3 3]);
y = reshape(randperm(27), [3 3 3]);
[value, index] = max(x, , 'linear');
Let's look at x side-by-side with y, separated by a strip of NaN values.
sideBySide = cat(2, x, NaN(3, 1, 3), y)
Look at the indices, the elements of x, and the corresponding elements of y.
I = index(:);
results = [I, x(I), y(I)]
As an example the second element in I is 4. If you look at sideBySize, the fourth element of x is 16 and the fourth element of y is 8. This is exactly what the second row of results shows.