People had to move their entire city towards the (horizon?). They traveled over all terrains--water, mountains, deserts. As they traveled they remained the same height. If they slowed down or sped up their bodies would get longer or shorter. I read it at least 20 years ago
You may be thinking of the 1973 novelette "The Inverted World" by Christopher Priest, which was expanded into a novel called [The] Inverted World. The story has come up before as the answer to this old question and this one and this one. Here is a plot summary from Wikipedia:
The book consists of a prologue and five parts. The first, third and fifth sections are narrated in the first person by the protagonist, Helward Mann; the second follows Helward, but is written in the third person; while the prologue and fourth part center on Elizabeth Khan, also from the third person perspective.
Helward lives in a city called "Earth", which is slowly being winched along at an average speed of 0.1 miles per day (0.16 km per day) on four railroad tracks northward toward an ever-moving, mysterious "optimum". The city, which Helward estimates is 1,500 feet (460 m) long and no more than 200 feet (61 m) high, is not on the planet Earth; the sun is disc shaped, with two spikes extending above and below its center. The city's inhabitants live in the hope of rescue from their lost home world.
Upon reaching adulthood at the age of "650 miles", Helward leaves the crèche in which he has been raised and becomes an apprentice Future Surveyor. His guild surveys the land ahead, choosing the best route. The Track Guild tears up the track south of the city to re-lay in the north. Traction is responsible for moving the city, while the Bridge-Builders overcome terrain obstacles. The Barter Guild recruits labourers ("tooks") from the primitive, poverty-stricken nearby villages they pass, as well as women brought temporarily into the city to help combat the puzzling shortfall of female babies. The Militia provides protection, armed with crossbows, against tooks resentful of the city's hard bargaining and the taking of their women.
Only guildsmen (all male) have access to the outside world and are oath-bound to keep what they know a secret; in fact, most people do not even know the city moves. Helward's wife Victoria becomes somewhat resentful when he is reluctant to answer questions about his work.
The purpose and organisation of the city is laid out in a document written by the founder: Destaine's Directive, with entries dating from 1987 to 2023. Helward reads it, but it does not satisfy his curiosity as to what the optimum is or why the city continually tries to reach it.
When Helward is assigned to escort three women back south to their village, he is astonished by what he learns about the alien nature of the world. As they go further south, the women's bodies become shorter and wider, and they begin to speak faster and in a higher pitch. The terrain itself becomes similarly squashed; mountains now look like hills to Helward. One woman has a male baby who, like Helward, does not change shape. Most frightening of all, the guildsman feels an ever growing force pulling him southward.
Abandoning the women, with whom he now cannot even communicate, he returns to the city. There he finds that time runs at a different rate in the south. In the city, several years have passed, during which the tooks have attacked and killed many children, including Helward's son. Victoria had given him up for lost and remarried. When Helward goes to survey the land ahead, he discovers that time passes more quickly in the north.
While returning from a negotiation at a settlement, he is followed by Elizabeth Khan, herself a relative newcomer to the village. They talk for a while. When they meet again, she mentions she came from England several months before. He becomes excited, thinking that rescue is finally at hand. She is unable to convince him that they are on Earth. Intrigued, she replaces one of the village women and enters the city, which to her looks no more than a misshapen office block. Once again, she encounters Helward. Having learned about the city, she leaves to apprise her superiors and to do some research.
Two crises strike. After the took attack, it was decided to educate the residents about their situation. This, however, had an unintended effect. Dissidents called the Terminators want to stop moving the city, and are willing to resort to sabotage to achieve their goal. Victoria is one of their leaders. A more imminent problem is a large, unavoidable body of water ahead with no opposite bank visible. Both dilemmas are resolved at a meeting.
Elizabeth explains to the citizens their true situation. A global energy crisis (the "Crash") had devastated civilisation, a disaster from which the world is only gradually emerging. Destaine was a British particle physicist who had discovered a new way to generate power, but nobody had taken him seriously. The process required a natural component to work. Destaine found one such in China: the optimum. He went there to set up a test generator and was never heard of again. His invention has serious permanent and hereditary side effects, distorting people's perceptions (for example the shape of the Sun) and damaging their DNA so that fewer females are born. After nearly two centuries, the city has reached the coast of Portugal, with only the Atlantic Ocean ahead. Most of the residents are convinced, but to Elizabeth's disappointment, Helward refuses to give up his beliefs.