There are direct and indirect effects of distance to the Bit Error Rate (BER) between two transceivers.
The direct effect that distance has on the BER is through the attenuation of the signal. As the transmitter get's further away from the receiver, the power of the received signal is diminished which makes the Signal to Noise Ratio lower which makes signal reception more difficult and the likelihood for a misinterpreted symbol higher.
This is the simplest case with the transceivers operating in free space where theoretically there are no other objects or sources of "noise".
The indirect effect of distance on the BER in a realistic environment (i.e. one containing surfaces that the signal can bounce off, such as buildings) is the introduction of multipath propagation. This means that multiple copies of the same signal arrive at the receiver at slightly different times having followed slightly different paths. Depending on the frequency of the signals, these slight delays may lead to destructive interference. In other words, two versions of the same signal cancel out each other. This condition leads, again, to a decrease in the SNR and signal distortions which leads to a higher probability for errors in symbol reception. A similar (indirect) effect is introduced due to the Doppler shift of the frequencies if the velocity of movement of the transmitter is comparable to the wavelength of the used frequencies.
There are multiple ways by which you can include these effects to a simulation.
When simulating the full transceiver stack, i.e. Source, encoder, modulator, channel, demodulator, decoder, Target then Free Space Loss can be applied at the output of the modulator (as part of the "channel" building block) as an attenuation of the produced signal given a distance L.
Multipath propagation can also be applied at the "channel" stage, either by convolving the modulator's output with a suitable impulse response or by generating an "envelope" signal from a Rayleigh distribution.
For more information, please see this, this (this) and this link.