This should be a comment but is too long. You may want to look at the literature on promise problems for NP-Disjoint pairs. They consider pairs (A,B) of disjoint NP-languages. One is to think of this as a promise that the words belonging to a language L belong to A and that none of the words in B belong to L. Then a P-language S with $A\subseteq S$ and $S\cap B=\emptyset$ is a polynomial time algorithm which on $A\cup B$ gets the correct answer and behaves arbitrarily on the remaining inputs. There seem to be a big literature on this. It seems if $P\neq UP$ (where UP is unambiguous polynomial time), there exist P-inseparable NP-sets. The assumption $P\neq UP$ is equivalent to the existence of a one-to-one worst-case one-way function. Apparently it is not known if $UP$ has complete problems. I am no expert on this.