As a verbal particle which immediately follows a verb, 得 and 到 can both be used in several ways. For example, 得 (able to) is used in 食得飽 as a potential particle. 到 (successful) is used in 揾到 as a resultative particle.
In your example of 行得辛苦, 得 (get) is used as an extent particle to introduce the manner of “walking”, i.e. the adverb 辛苦. We can also say 行得輕鬆 as 輕鬆 is an adverb.
On the other hand, we can’t say 行到辛苦. As an extent particle, 到 (till/until) can only be used to indicate the result of "walking". For example: 行到癐, 行到鞋底穿窿.
In your example of 行得辛苦, 得 (get) is used as an extent particle to introduce the manner of “walking”, i.e. the adverb 辛苦. We can also say 行得輕鬆 as 輕鬆 is an adverb.
On the other hand, we can’t say 行到辛苦. As an extent particle, 到 (till/until) can only be used to indicate the result of "walking". For example: 行到癐, 行到鞋底穿窿.