The efficiency of optical networks employing flexible wavelength division multiplexing (WDM) can be increased by maximizing the throughput of each individual channel, provided that the position of its neighboring channel is known with sufficient accuracy in order to avoid inter-channel interference. In this paper, we propose a digital signal processing (DSP) algorithm, leveraging the use of an artificial neural network (ANN), to estimate the neighboring channels’ distance by processing raw digital samples from a standard coherent receiver. We present an efficient dataset design approach, based on Latin hypercube sampling (LHS), in order to effectively optimize and validate the algorithm under different assumptions on the optical WDM channels. We investigate the accuracy of the ANN-based DSP scheme through simulation analysis, highlighting its potential in relation to the characteristics of the optical network. Finally, we validate our approach in an experimental setup using standard commercial coherent transceivers. The experimental results show that the distance from the neighboring WDM channels can be estimated with a root mean square error of less than 1.5 GHz for a channel under test with a symbol rate of 52 GBaud.