Window units are designed with compressors that cycle on and off automatically, so they'll handle 24/7 operation without mechanical failure. The bigger question is whether you actually need it running that constantly, and the answer probably depends on your setup. If your room stays reasonably cool once it hits your target temperature, the unit will just sit idle most of the time - compressors cycle down when demand drops. That's actually the efficient scenario, and your electric bill won't spike dramatically compared to something like leaving a space heater on all day.
Where you might see real costs add up is if your room is poorly insulated or gets direct afternoon sun. In that case, yeah, the AC will be working hard for hours on end, and that's when electricity consumption becomes noticeable. I'd suggest trying it for a week and checking your meter or bill - you'll get a real sense of what it actually costs you. If the room is staying hot because of heat gain during the day, you might save money by closing blinds or curtains during peak sun hours and letting the AC handle the evening and night when outdoor temps drop.
Safety-wise, there's nothing risky about continuous operation as long as the unit is properly installed and the filter isn't completely clogged. A clogged filter makes the system work harder and can cause it to overheat, so just check it every month during heavy use and swap it if needed. Beyond that, you're fine leaving it on.