How do I pin a UI element to an object in the game world?

I’m trying to create an interactive tooltip for an object in the world, like [E] Open.
Is it possible to attach an element on a CanvasLayer to an object in the world?

In 2D just attach a Label node to the object.

If it’s a 3D game, use a Label3D.