A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
This really isn't the forum for how to use Power Query, but there is no technical reason not to use Power Query to provide the distinct values, sort them however you like, then continue processing on them. Dynamic Array functions are not good ways to get data into Power Query. In fact, it is impossible. To get data into Power Query, it has to be a table, and DA functions return #SPILL! errors in tables. They are not compatible with them.
I'd need to see your data to understand why you think it (Excel/Power Query) isn't properly elminating or overeliminting entries. Your data might need to be trimmed or cleaned (both can be done in PQ) before you use Table.Distinct on it. You may also have spaces that are really char code 160 and not 32, which needs to be replaced, also done in PQ.
The best place for that type of support if the above still doesn't get you want you need is the Power BI community in the Power Query forum. Excel Power Query is also discussed there.
If you post data there for me to look at, you can tag me @edhans in that forum.