Will IPointerEnterHandler will work for 3d colliders?

I have added a Physics2d Raycaster in the Main Camera.Later added a script to the gameobject to check if mouse position is inside the gameobejct but not working?
What I tried is added a line using LineRenderer then added a capsule collider around it.But is not detecting the mouse position inside it.

Monobehaviour includes OnMouseEnter, OnMouseExit and OnMouseOver methods if they are any good to you?

As the name suggests, Physics2DRaycaster only takes 2D physics into account. Capsule colliders are 3D physics objects, so you’ll need the 3D raycaster, which is simply called PhysicsRaycaster.

You can use only either one of them…?