The Modelica.Blocks.Discrete.UnitDelay does not delay the input as described in its documents.
Given an example model as below, where the unitDelay_MSL is the delay block from MSL and the unitDelay_Corrected is the one with correction.

It has the results as:

The unitDelay_MSL.y is the same as the output from the sampling block, while the unitDelay_Corrected .y is the expected one.