With the Australian Square Kilometre Array Pathfinder (ASKAP) we monitored the black hole candidate X-ray binary MAXI J1535--571 over seven epochs from 21 September to 2 October 2017. Using ASKAP observations, we studied the HI absorption spectrum from gas clouds along the line-of-sight and thereby constrained the distance to the source. The maximum negative radial velocities measured from the HI absorption spectra for MAXI J1535--571 and an extragalactic source in the same field of view are \(-69\pm4\) km s\(^{-1}\) and \(-89\pm4\) km s\(^{-1}\), respectively. This rules out the far kinematic distance (\(9.2\pm0.2\) kpc), giving a likely value of \(4.0\pm0.2\) kpc, with a strong upper limit of the tangent point at \(6.6\) kpc. These distance limits indicate that the peak luminosity of MAXI J1535--571 was \(>75\) per cent of the Eddington luminosity, and shows that the soft-to-hard spectral state transition occurred at the very low luminosity of 1.2--3.3\(\times10^{-5}\) times the Eddington luminosity. Finally, this study highlights the capabilities of new wide-field radio telescopes to probe Galactic transient outbursts, by allowing us to observe both a target source and a background comparison source in a single telescope pointing.