If it is unstable when gliding it's probably because the engine is the heaviest part of the plane and they're usually in the back. In actual planes the mass of a back-mounted engine is offset by fuel or armament up in the front, either way the engineers have more options to shift the CoM to where most of the lift is. In KSP though the heaviest parts of a rocketplane are always the engine and the fuel in the tank. And usually you place both in the back, that creates problems.
Which is why most of the time my KSP spaceplanes use frontal canards with wings in the back like the Spess Hawk 2 does:
The Spess Hawk 1 didn't have those and lacked the rudders on the ends of the wings:
The result was it pitched up or down, also it easily entered spins during turns. Note that on both the wings are V shaped and go quite a way behind the engines. Adding the frontal canards fixed that. The, uh, winglets in the back above the main axis of the wings are just there to add some lift in the heaviest place. Not use if they're really needed but I got used to them. They did make the thing impossible to launch on top of a rocket though, they don't do anything in horizontal flight but if you're going vertical the lift tilts the rocket. I prefer the aesthetically pleasing design of the Spess Hawk 1 but the Spess Hawk 2 flies really smoothly, apart from needing more runway than the KSC has to take off. But the first one had the same problem anyway, 4 jets are a bare minimum for such a big SSTO spaceplane, 5 would be better if I knew where to put the extra one and how to place 4 rocket engines around it.
Either way the main thing you should remember is that lift needs to be roughly proportional to the weight across the length of the plane. Otherwise it keeps pitching up or down regardless if you have enough or not enough lift to actually fly. So you need more wing surface where most of your mass is and less in the lighter parts.
The issue is of course that wing shape limitations screw you over at times hence you make the wings too big or too small where they need it most. Luckily the procedural wings mod exists, install that and never go back to regular stock wings unless you need to make a rudder or something.
I think I'll try to recreate a white knight+space ship one skylaunch combo since the procedural wings make it easier. They should honestly introduce those into the stock game when they'll be doing the aerodynamics and spaceplane part overhaul. Also that would mean they would have a better interface as the mod's one is a bit clunky and counter-intuitive (the wings themselves work great though, apart from a rendering bug where they disappear at some camera angles).