Tunable work function has a high profile for the MXene-based optoelectronic devices, and surface modification provides the huge potential to shift its Fermi level and modulate the work function. In this work, the window of MXene's work function is engineered from 4.55 to 5.25 eV by surface modification with LiF, Se, and polyethylenimine ethoxylated (PEIE). The vertical p-CsCu 2 I 3 /n-Ca 2 Nb 3-x Ta x O 10 junction photodetectors are constructed on the basis of the above surfacemodified MXenes, which changes the Schottky barrier between n-Ca 2 Nb 3-x Ta x O 10 and the electrodes. In particular, the rectification effect is significantly enhanced by utilizing PEIE-decorated MXene electrodes, resulting in a high rectification ratio of 16 136 and improved UV responsivity of 81.3 A W -1 . Such high-performance devices based on MXenes electrodes are compatible with the standard clean room fabrication process, realizing large-scale flexible UV detectors that maintain 80% of the original current after 5000 times bending. Meanwhile, a photodetector array stimulated with UV of different wavelengths is constructed to reveal its potential for image sensing. Finally, functional "AND" and "OR" optoelectronic logic gates are developed for UV communication using Au/ CsCu 2 I 3 /Ca 2 Nb 3-x Ta x O 10 /MXene-PEIE photodetectors, enriching the application of MXene-based optoelectronic devices. This work on tuning MXene work function via surface modification demonstrates that MXene is a promising candidate for future optoelectronics.