Your use-case is two-fold:
Projecting your 2d mouse coordinates to 3d world coordinates, to create a ray.
Performing collision detection on the new coordinates, compared to your game objects.
NDC to 3D world coordinates
To do this, you need your view and projection transform matrices:
mat4 view = lookat(camPos, camPos+camDir, vec3(0.0f,1.0f,0.0f);
// For ...
You can not do this in your current state. You'll have to split your background into tiles and render them in a correct order, also your character should be in this render queue. You need to either preserve the right amount of space on Z axis to fit sprites and characters, or make a render texture use it in your queue. This way everything will be flat and ...