In a vacuum with no other functions to consider it doesn't matter. Let's put it this way. You can't go wrong putting it in a new library or module. That's especially true if there are many functions that X and Y share. You can go wrong putting it in X. If you followed the same procedure and added one to Y that X uses after that then you're right back where you're at right now.
That's why each module should do one job to the greatest extent possible. Your lowest level modules might be a bit of a mishmash because they could provide many low level services, but higher level ones should do one job so that they don't need to depend on one another. That way when you want to do one specific thing, you can include as little as possible and not have to get a huge group of modules to do one small job.
My mission: To boldy split infinitives that have never been split before!