When cells measure concentrations of chemical signals, they may average multiple measurements over time in order to reduce noise in their measurements. However, when cells are in an environment that changes over time, past measurements may not reflect current conditions—creating a new source of error that trades off against noise in chemical sensing. What statistics in the cell’s environment control this trade-off? What properties of the environment make it variable enough that this trade-off is relevant? We model a single eukaryotic cell sensing a chemical secreted from bacteria (e.g., folic acid). In this case, the environment changes because the bacteria swim—leading to changes in the true concentration at the cell. We develop analytical calculations and stochastic simulations of sensing in this environment. We find that cells can have a huge variety of optimal sensing strategies ranging from not time averaging at all to averaging over an arbitrarily long time or having a finite optimal averaging time. The factors that primarily control the ideal averaging are the ratio of sensing noise to environmental variation and the ratio of timescales of sensing to the timescale of environmental variation. Sensing noise depends on the receptor-ligand kinetics, while environmental variation depends on the density of bacteria and the degradation and diffusion properties of the secreted chemoattractant. Our results suggest that fluctuating environmental concentrations may be a relevant source of noise even in a relatively static environment.