Path.relative breaks for paths that differ by trailing separator in v23.0.0

Version

v23.0.0

Platform

23.6.0 Darwin Kernel Version 23.6.0 arm64

What steps will reproduce the bug?

$ nvm use v22.10.0
$ node
> require('path').relative('/root', '/root/')
''

$ nvm use 23 
$ node      
> require('path').relative('/root', '/root/')
'../root/'

How often does it reproduce? Is there a required condition?

Consistent

What is the expected behavior? Why is that the expected behavior?

require('path').relative('/root', '/root/') should return '' like in previous versions of node

What do you see instead?

require('path').relative('/root', '/root/') returns '../root/'

Additional information

Reproduces on Window and Ubuntu.