Here's a simple drawing to suggest a strong way to do this. No pocket screws needed. The structure and glue hold the frame together and the ply provides strength to prevent racking.
I did not include the plywood in the drawing but it insets into the dado on the leg and the top/bottom rails.
Two advantages to doing it this way over pocket screws - strength and you hide the plywood edge in the solid wood frame.
The leg and rail are sized 3.5" x 1.5" with 1/2" dados and tenons. You could go to 3/4 ply and grooves, but that's probably overkill for a head / foot board. You can cut these with a router if you don't have a table saw with a dado bit.
I chamfered the interior edge 1/8" on a side, again using a router with a bearing guided bit. Apply this technique on your headboard, footboard and connecting side where you are doing a day-bed and you'll have a simple technique that finishes nicely and removes the chance of splintering.
If you are using 2x4 material from the lumberyard for leg and rail, it's typically going to be rounded over. That means where you join rail(horizontal) to leg(vertical) you need a square cut. So you might rip down the legs if you want a flush joint. If your legs are larger like at 4x4, you can still use this joint but don't need to worry about the edge being rounded over.
I included a 4x4 post showing both a 1/2 and a 3/4 dado and tenon on the rail. Either will work, but you probably don't need to go to 3/4 plywood if you can source the material in the species you want in 1/2" ply.
Lots of options. I'd suggest you draw things out either on paper or with a program like Sketchup so you can figure these details out before you start cutting too much wood. Cheaper and less frustrating!
2x rail and leg with a chamfer on show side of rail
View attachment 1
2x rail with a chamfer with options on leg / panel dado's of 1/2 or 3/4"
View attachment 2
Good luck!