I want to go to graduate school for a PhD, but as a safety I'm also considering applying to master programs in the same or related field, if my undergraduate credentials are not strong enough for top programs. Would applying to the masters program where I am also applying for a PhD send the wrong message to the school though, that I'm not sure if I want to do this for a full PhD or not? Or do they understand that people apply to masters program as a back up for if someone's PhD applications don't go well?
Applying for multiple programs is common and unlikely to reflect badly upon you. Applications committees for different programs are usually made up of different members and it is highly unlikely that they will even know that you applied to both programs. The only time it might be revealed is when it goes to the administrators who send out the letters, and frankly they could care less.
Something to note, which affects both this issue and your overall considerations of a program, is that schools usually look for different things in a PhD program vs. an MA, and that affects how they conduct their admissions. At many school, MAs are not just less-capable versions of PhD students, they are completely different type of student.
Terminal MA programs are usually unfunded, and include people who are less likely to conduct independent research. Some MA students will go on to a PhD program, but probably not at the institution where they get the MA. For this reason, MA programs at many schools are called 'cash cows' and admissions to those programs are less of a priority for the full faculty, with a lot of the sorting done by administration, focused on funding potential, and stricter considerations about things like GREs, etc.
PhD programs are research training to become academics, or at least independent researchers, and most PhDs are fully funded. Since the university is investing in you, and the faculty will be stuck with you in person for 5-10 years, and reputationally forever, the faculty care a great deal about this. Considerations like the ability to pay, and even strict measures of capacity like test scores, take a secondary role to creativity in the field, goodness of fit, and so on.
Simply put, in many schools you have to impress two different sets of people to get admitted, with overlapping but different priorities. There are idiosyncratic reasons why you may be admitted to one program and not the other, and sometimes it might even be that you get into a PhD and not an MA. (On balance, however, admissions to an MA program is more likely than a PhD, simply due to the volume of admissions.)