I see deeper problems here. What is the foundation for those walls? Why is all that sand there, and why is it just inches below the door threshold? What is with those gaps in the second picture, that you can see a void behind.
I see the spray foam scraps, which tells me you just closed up those walls, and I see the plastic sheeting that tells me "vapor barrier ends here". Also, the edge of that subfloor is suspiciously clean for the last 6", which tells me a wall was there.
Is this by any chance a porch that you are closing in? Is there a concrete slab under that sand, or soil. If it's just soil, then your are allowing moisture and insects access to your framing.
EDIT - RESPONDING TO COMMENTS
I believe this was a porch that got "annexed" into the interior space of the house.
The right way to do this is to dig all that sand and soil out, and also excavate under the walls (they will need to be temporarily supported). Then prep the excavation (I'm not sure if a vapor barrier is called for, but you have one coming out from your existing foundation, so ask a local builder) and then pour a slab under the whole deal - walls and all. You would probably be replacing the bottom plates of the walls in the process.
A concrete slab is going to be cold in the winter, and I might worry about condensation in that area - plus, the fact that it is sunken, and kind of small - is it really that useful?
If the ceiling height will allow it, wouldn't it be nicer to bring the floor up to match the rest of the house? This will mean re-installing the door, but the you could just frame in a subfloor, put a vapor barrier down, and end up with a MUCH nicer space there.