Driver not updated on dimension changes
Give the red cube a dependency on the blue slider. Do this by adding a new variable as the slider location.z, you don't need to use this variable in your expression calculation but having it there adds a dependency that updates the location as you want.