There is no harm in applying for a position that you're not sure you'd take.
If you're currently employed, the interviewer will almost certainly ask about why you're thinking about leaving your current position. If your concern is primarily about salary, as an example, they'll probably ask about your current salary and/or ask what sort of ballpark salary range you'd need an offer to come in at to leave your current position and/or tell you the salary range of the position and ask whether that is something you'd consider. If your concern is about something other than salary, the conversation will be about whatever those concerns are (health plans, retirement plans, flex time, etc.) If it becomes clear at that point that they wouldn't be able to make an offer that you would accept, you can thank them and politely remove yourself from consideration.