Sizing two different objects to the same size

This is probably been answered a million times but i need to size half a cylinder to the the exact with of a cube without deforming the circular shape of the half cylinder.

You’re not showing two different objects but two separate meshes within one object.

Could use vertex snapping. First move and snap the half cylinder along Y so that its closest edges align those of the cube. Then set the pivot point to be in the middle of the cylinder (now a half) and scale along X and Y while snapping to one of the cube corners. Could then scale along Z to match the height.

If you plan to connect them, faster way is to delete the cube part and extrude from the half cylinder. Could also then use rip or split tool to separate the two again.

Push the semicylinder on the Y until it snaps to the cube. Go to Vertex Mode, and select the center vertex of the semicylinder, and Shift-S, a Move Cursor to Selected. Use period, to move 3D Cursor to vertex, then scale so the line snaps to the cube’s side. In the side panel to the left, set the Z scale value to 1.