Non-quadratic search for specific difference between elements in sorted array
I know of two.


Sort the numbers, then walk 2 pointers from opposite ends towards each other, moving the left pointer rightward whenever the difference of the pointed-to elements is too small, and the right pointer leftward whenever it is too large; the invariant here is that any satisfying pair must be taken from the interval of elements spanned by the 2 pointers.
Build a hash table containing every element as key (the value for each key is unimportant), then loop through every element $x$
again, checking whether $x+d$ or $x−d$ is in the hashtable.