You are an inch or two taller in the morning than at night. Although it happens to the whole cartilages in your body, your disks between the vertebrae in the back , in particular have a lot of pressure on them during all day along when you are upright. They flatten, primarily by having water squeezed out, but also by simple mechanical oblation. At night, they are not pressed, regain their shape, and reabsorb water. (This all takes an hour on average, so napping will make you taller, too, by some small amount. But since muscles only need 20 minutes or so to recover completely no matter how tired they are, and maybe an hour for the disks, that still doesn’t explain why we need sleep since the recovery of the body is complete in about an hour.) Hydrating yourself before bed may make you even taller in the AM (if you are even slightly dehydrated at night). But…more trips to the toilet, too.
In order to say what the “best time” is to measure your height, there would need to be a definition of what “real” height is. There isn’t one. Therefore, all people have a range of heights. None of them is the “correct” height. But to measure change in height, the measure should be done at the same time of day both times, and under the same degree of hydration, if possible (A person will be taller in Winter than in Summer in the AM if they have been sweating out water all night, for example).
If you want to be taller, use the AM measure after a night where you drank water before bed. Sleeping for a year will not make you 30 feet tall, especially considering how dehydrated you are likely to be.
Swimming helps to stretch your overall body.
Make sure you swim a minimum of ten laps when you’re in the water. Tire yourself out. Your body will start pumping adrenalin which also relieves the stress that prevents you from growing. The more swimming sessions you undergo, the more your backbone will stretch. This will create spaces between the bones which then have to grow naturally.