Thanks for your question. It’s certainly an interesting one! Typically with normal healthy discs you tend to be “taller” in the morning once they have had a chance to recover from the rigours of the previous day.
They tend to absorb fluid and hence are fuller - giving the impression of increased height. Often by the end of the day, with muscle fatigue and a degree of dehydration, intervertebral discs tend to shrink a little and hence you are a little “shorter”.
The commonest spinal cause for loss of height would be a vertebral collapse - maybe from a trauma or tumour. A disc prolapse in theory could lead to this too, particularly if it is very bad, but to be honest you would probably have other issues such as nerve symptoms to go with it. For minor changes, the loss is probably not that significant.
To limit the impact, I would suggest maintaining your back health - good hydration, rehabilitation and exercise.
I hope this helps.