1/6

When two inputs have genuinely unrelated lifetimes, give them separate names. The one that matters is the one on the output.

fn prefix<'a, 'b>(text: &'a str, sep: &'b str) -> &'a str

This says something precise and useful: the result borrows from text and not from sep. The caller may therefore drop sep immediately and keep using the result.

Collapsing both to 'a would compile too — and would silently tie the result to sep as well, forcing the caller to keep alive something the function never borrowed from.