Hi,
The GUI functions require a GUI Layer component I think.
You don't need GUIPointToWorldRay.
Assuming the tilemap is perpendicular to the camera (i.e. no rotation on camera or tilemap) you don't need the plane intersection either. If your camera is perspective you'll need the line that does mousePos.z, otherwise you can remove that too. This gives you the X, Y tilemap coordinate where the mouse is on.
Vector3 mousePos = Input.mousePosition;
mousePos.z = tileMap.transform.position.z - cam.transform.position.z;
Vector3 worldPos = cam.ScreenToWorldPoint(mousePos);
int tileX = 0, tileY = 0;
tileMap.GetTileAtPosition(worldPos, out tileX, out tileY);