Since you were questioning the distance between a water hester and water softener, I am assuming you were advised to install a check valve after the WS, which then lead to discussion about an expansion tank for your WH.
Water expands as it is heated. Water cannot be compressed so as cold water enters the WH and is heated, once no water is further being consumed, expansion will commonly push back into the cold inlet line to be absorbed by either the city water main or, if well water, into the well pressure tank.
Placing a check valve after the WS, creates a closed system as the water expansion from the WH can no longer flow backward through the WS to the water main or pressure tank. With nowhere for the expansion to be absorbed, the system pressure after the check valve will rise sharply above the usual system pressure, and often above the usual safe limit for the plumbing system. Once the pressure rises to 150 psi, as a safety device, the WH's T&P valve will typically begin to seep to drain off some water to prevent the pressure from rising further.
The amount of expansion is dependant on the quantity of cold water being heated, the initial temperature of that water, and the amount of temperature rise.
A thermal expansion tank will provide space for the expanded water to be absorbed without causing the system pressure to rise excessively.