Ribosomes stalled during translation must be rescued to replenish the pool of translation-competent ribosomal subunits. Bacterial alternative rescue factor B (ArfB) releases nascent peptides from ribosomes stalled on mRNAs truncated at the A site, allowing ribosome recycling. Prior structural work revealed that ArfB recognizes such ribosomes by inserting its C-terminal alpha-helix into the vacant mRNA tunnel. In this work, we report that ArfB can efficiently recognize a wider range of mRNA substrates, including longer mRNAs that extend beyond the A-site codon. Single-particle cryo-EM unveils that ArfB employs two modes of function depending on the mRNA length. ArfB acts as a monomer to accommodate a shorter mRNA in the ribosomal A site. By contrast, longer mRNAs are displaced from the mRNA tunnel by more than 20 A and are stabilized in the intersubunit space by dimeric ArfB. Uncovering distinct modes of ArfB function resolves conflicting biochemical and structural studies, and may lead to re-examination of other ribosome rescue pathways, whose functions depend on mRNA lengths