library/module_utils functionality question

If a module with the same name as a core module exists in the ./library or ./module_utils directory of the plabyook, which module will be get invoked when I reference it in my playbook?

I have a need to modify the functionality of a core module. I could refactor/rename it to [module]_internal or simply copy the module to ./library and add the needed functionality, so I’m curious how others have approached this. I see benefits of creating a new (renamed) module with the added functionality and refactoring my playbook to invoke this module instead, but there’s other benefits to just slipping the modified module directly into the ./library directory so that no further changes are required in the playbook.

Thoughts?

Follow-up. I tested copying a module from core into the playbook library. Modifying the content, without altering the module name and observed that ansible.library picked up the local module first.