I have bunk beds for my tow and got them when they were almost 4 and 51/2. Most models have a rail on the top bunk so it's hard to fall out when sleeping, however, i'd be concerned with the little one climbing and wanting to play up there. It's a pretty big fall from the top. They do make them where the ladder is removable, (they sort of hook on for to secure them) but my kids have been known to climb from the ends too.
If I were you I would think about a bed with a trundle. It's as space saving as a bunk when pushed in, but you need the floor space to have it pulled out.
Good luck!!