What type of wood should I use for a washer/dryer platform?
I assume you must mean a platform (or separate platforms) resting on the floor. I think the commercial steel ones are called pedestals. ("Shelf" suggests attachment to the wall.)

I would use 2x4 frames with 3/4" plywood on top. It could be that 2x2 would work (at least in front) to give more room underneath. If you already have the 2x4s, then lay the front ones on their sides to give more clearance.

A homemade platform might not be able to handle the vibration from the spin cycle of the washer. Washers do sometimes move across the floor. This platform should have a slight raised rim, short enough to permit lifting of the machine onto the platform but tall enough to prevent it from sliding off.  I think lockable casters or at least plastic skids would be a terrifically useful enhancement. One does have to slide these out from time to time.

We have a tall top loader washer which my wife has trouble reaching down into. Think about the appropriate height. Also she cannot easily reach the cut-off valves behind this washer. I had put short extensions on the supply lines when we had a shorter washer and I replaced the original sweated on rubber washer globe valves with ball valves, but longer extensions are what we need now (and I have plenty of room for it) but that's down on my list. If you have room in the box, you might consider whether you should raise the height of the cut-off valves.

Edit

I asked someone who built one of these platforms for his washer and dryer and here are his comments.

I did make it because I thought that the manufactured ones were outrageously expensive.  It is a box constructed with a 2x4 frame and sheathed on 4 sides (I didn't do the bottom and back--but if I ever move it I plan to sheath the back also) with particle board and painted.

The dryer is light enough to lift off.  I move the washing machine by moving it onto a temporary step that I create in front of the platform using the lift and twist approach.  Then I move it onto the floor. (I have access to one side of the washing machine.)  If I had to slide it, I would lift up each side and place a rug under the feet.

Height from floor 17".  Wife at 5'4" tall picked that height. The platform is 5' wide by 38" deep.  The washer sits back 5" from the front and about 3" from the side. There is no lip or foot depression.  The "rubber" cap on the metal feet provides adequate friction to prevent movement.

The commercial metal platforms are built with drawers in them as a selling point. You could fit 12" deep drawers or an open shelf under mine.  My front face provides a lot a structural integrity to prevent racking or vibration of the frame. If you did drawers you would need to compensate for that loss of integrity in the design.