Find the minimum cost matching between arrays of integers
Jelly, 15 14 12 11 bytes

Œ!ż€IASƊÞḢṁ


Try it online!


-1 byte thanks to Jonathan Allan
-1 byte thanks to Mr. Xcoder
-2 bytes thanks to an anonymous editor


Brute force. Takes input as \$Y\$ then \$X\$.

Œ!ż€IASƊÞḢṁ
Œ!                 All permutations of Y.
  ż€               Zip each of the permutations with X.

       ƊÞ          Sort by:
    I              Difference of each pair.
     A             Absolute value.
      S            Sum.
         Ḣ         Take the first matching.
          ṁ        Mold the result like X. Keeps only values up to the length 
                   of X which removes unpaired values from Y.