For antenna gain measurement you're needs to place receive antenna at least half wavelength away from transmitting antenna. Otherwise your measurement will be affected by near field of antennas.
Actually the more complete way to calculate minimum distance between antennas is the following:
R = 2 * D^2 / lambda,
where:
R - minimum distance between antennas in meters
D - maximum dimension of your antenna in meters
lambda - wavelength in meters (lambda = 300 / frequency_in_MHz)
If possible place antennas at more longer distance, for example at least on 2-3 lambda. It will reduce near field influence.
Also calibrate NanoVNA through cables which you're using to connect antennas. It will reduce cable influence.