This issue is likely that you're trailing whitespace includes things other than spaces. The most common culprits are Tabs (CHAR(9)), and like breaks CHAR(10) and CHAR(13). Using Ngrams8K you can easily identify the problem; consider this example:
DECLARE
@string VARCHAR(100) = 'test 123 Add
'
I include a tab, a couple spaces and more. Using Ngrams8k we can do this:
SELECT ng.Position, ng.Token, [ascii] = ASCII(ng.Token)
FROM dbo.ngrams8k(@string,1) AS ng;
Returns:

Here we can use TRIM.
THE MOST IMPORTANT THING TO KNOW ABOUT TRIM IS THAT IT IS NOT RTRIM(LTRIM(
!!!
TRIM is power-packed and is intended for handling more than whitespace; note this example from the documentation:

The culprit in this example are CHAR(9)'s (10)'s and (13)'s. Armed with this knowledge we can use TRIM like so.
DECLARE
@string VARCHAR(100) = 'test 123 Add
',
@trim VARCHAR(10) = CHAR(9)+CHAR(10)+CHAR(13)+CHAR(32);
SELECT TRIM(@trim FROM @string) AS Result;
If you are not on 2019 you can always do this:
SELECT
SUBSTRING(@string,1,
DATALENGTH(@string) - PATINDEX('%[A-Z]%',REVERSE(@String))+1);