Find a Similar Number
Python 3, 58 52 bytes



lambda n:[9-(9in n)-sum(x&gt;d for x in{*n})for d in n]


Try it online!

Input: The number n, as a list of digits.
Output: A similar number, as a list of digits.

-6 bytes thanks to @xnor!

How:
Reverses the list of unique digits, then maps them to 9,8,7,... or 8,7,6,... depending on whether n contains the digit 9 or not.
For example:

               | n = 1827 | n = 7899
Reverse unique |   8721   |   987
Maps to        |   9876   |   876
Results        | m = 6978 | m = 6788


Old solution

Python 3, 80 bytes



f=lambda n,i=9:(i in n)^(i-1in n)and[[d,d^i^~-i][i-2&lt;d&lt;=i]for d in n]or f(n,i-1)


Try it online!

Input: The number n, as a list of digits.
Output: A similar number, as a list of digits.

-1 byte thanks to @KevinCruijssen!

How
The solution tries to find a pair of consecutive digits \$(i-1,i)\$ such that one digit appears in \$n\$, and the other doesn't. It then replaces all occurrences of one digit with the other.
The pair of digits are searched from \$(8,9)\$ downward, in order to discourage replacing 1 with 0.