I'm curious if it is generally better for the knees if I should sleep on my back with legs straight out or on my side with legs bent towards my chest?

Bend knees for back. Not sure if it makes any significant difference to the knees. However, it is generally best for the back to either sleep on the back with a pillow under the knees, or on the side with the knees slightly bent.
Avoid knee pillow. Pillows under the knees produce flexion contractures of the knees, which is a much bigger problem.