I dont know if there is a function to do it in Unreal, but basicly its…

First get the Vector of Mouse position, then you have to set the vector to range -1/1 (cube coords) , its FVector cubeCoord ((mousePos.x/width2) - 1, -((mousePos.y/height2) -1), -0.5); where width and height are the size of the viewport of the camera. Then use that cubeCoord the the camera to get world position like this:

First get the inverse Matrix of the camera JUST LIKE THIS, DONT CHANGE THE ORDER OR IT WONT WORKS, FMatrix inv = (CameraProjectionMatrix * CameraViewMatrix) * Inverse, here you have to get the projection matrix of the camera times view matrix of the camera and then get the inverse of the resulted matrix. Last thing create another FVector multiplying the inv time cubeCoord ( FVector(inv * cubeCoord)) and that vector should be the world position of the mouse location

I made this in Ogre3d, but the idea its the same maybe there is an easy way to do it in Unreal but if its not, you can do it with this. I made this long time ago and i dont know if its entirely correct hehe.

EDIT: maybe the Y coord of the cubeCoord its wrong, depending if the position of height 0 its up or down and its the same of Ogre