Many proteins are assigned a function based on predicted computational homology. However, characterisation of function based solely on homology searches may overlook functions under specific environmental conditions, or the possibility of a protein having multiple functions. In this study we investigated the function of YtfB, a protein originally identified in a genome-wide screen to cause inhibition of cell division when overexpressed1, and which has been recently demonstrated to localise to the Escherichia coli division site with some degree of glycan specificity2. Interestingly, YtfB also shows homology to the virulence factor OapA from Haemophilus influenzae, which is important for adherence to epithelial cells, indicating the potential of additional function(s) for YtfB. Here we show that E. coli YtfB binds to chitosan and di-mannose glycans with high affinity. The loss of ytfB results in a reduction in the ability of the uropathogenic E. coli strain UTI89 to adhere to kidney cells, but not to bladder cells, suggesting a specific role the initial adherence stage of ascending urinary tract infections. Additionally, the ΔytfB mutant is outcompeted for growth by the wild type in human urine, whilst loss of YtfB results in hypermotility. Taken together, our results suggest a role for YtfB in the switch of a motile to a sessile lifestyle in the environment of the urinary tract, which may be additional, or complementary, to its role in cell division, and highlights the importance of understanding protein function in the context of different environmental conditions.