Due to the large number of waterborne bacteria presenting in drinking water, their rapid and accurate identification has become a global priority. The surface plasmon resonance (SPR) biosensor with prism (BK7)-silver(Ag)-MXene(Ti3T2Cx)-graphene- affinity-sensing medium is examined in this paper, in which the sensing medium includes pure water, vibrio cholera (V. cholera), and escherichia coli (E. coli). For the Ag-affinity-sensing medium, the maximum sensitivity is obtained byE. coli, followed byV. cholera, and the minimum is pure water. Based on the fixed-parameter scanning (FPS) method, the highest sensitivity is 246.2 °/RIU by the MXene and graphene with monolayer, and withE. colisensing medium. Therefore, the algorithm of improved differential evolution (IDE) is obtained. By the IDE algorithm, after three iterations, the maximum fitness value (sensitivity) of the SPR biosensor achieves 246.6 °/RIU by using the structure of Ag (61 nm)-MXene (monolayer)-graphene (monolayer)-affinity (4 nm)-E. coli. Compared with the FPS and differential evolution (DE) algorithm, the highest sensitivity is more accurate and efficient, and with fewer iterations. The performance optimization of multilayer SPR biosensors provides an efficient platform.