The internet is awash with questions and answers for producing a nice looking tilde. But my goal is to produce output (PDF, let's say) from which one can copy-paste into another application and get the same result as typing the ~ character from the keyboard. I don't care how it looks, I only care if it can be copy-pasted.
This is not a question about how to display a tilde symbol. \textasciitilde, \~{}, and $\sim$ all do that. However, the first two generate (UTF-8)CC83 = U+0303 = "combining tilde" and the last generates (UTF-8)E288BC = U+223C from the mathematical operators table. (As determined by pasting into emacs and using hexl-mode.)
It seems as though there should be a font-independent solution, considering that ~ is in ASCII (U+7E, to be specific), and therefore should be present in every font. The answer may be font (encoding) dependent, since ~ is not a required glyph for general text encodings (LaTeX font encodings section 3.1). But all (La)TeX code I've found (including the url package) generate higher UNICODE characters, so it would be surprising if an ASCII character were impossible.

\textasciitilde? As in,\documentclass{article} \begin{document} \textasciitilde \end{document}? – Mico Feb 10 '23 at 04:33\textasciitildewas not listed, and no other code would apply. So the OP request is certainly not unreasonable. However, I discovered that\~{ }works (it puts a tilde "over" a space, resulting in an ordinary tilde that can be copied and pasted in text, as requested). – rallg Feb 10 '23 at 04:47\textasciitildeshows up in Table 2, "Predefined LATEX2 Text-mode Commands". (A footnote to this table points out that "\~{}can be used ... instead of\textasciitilde".) This makes me think that suggesting\textasciitildeas a solution wasn't particularly unreasonable. – Mico Feb 10 '23 at 06:52\~{ }, but apparently that worked for you. Could you give specifics: Were you copying out of a PDF? What PDF viewer? What were you pasting into? – James6M Feb 13 '23 at 07:271 < 2in OT1 for a clearer example, for~the character in slot 7E of OT1 is the tilde accent sõnot~which is why\~{}putting a tilde accent on nothing is an approximation and is the definition of\textasciitildein OT1 – David Carlisle Feb 13 '23 at 08:59accsupppackage to provide a real~for cut and paste around a visual\~{}– David Carlisle Feb 13 '23 at 09:03\verb|~|compiled with xelatex. (Not tested.) – barbara beeton Feb 15 '23 at 04:15\textasciitilde(or\string~or\char"7E) in lualatex or xelatex? That would be weird. – David Carlisle Feb 15 '23 at 10:23