Non-mining full nodes can not prevent an attack at 51%, but they are essential to prevent further attacks.
In particular, complete nodes verify that the chain produced by minors is valid. This means that no coin will be transferred without the proper authorization of its owner, that no new coin will be created from scratch (except those authorized by the inflation program) and a few other things.
The complete nodes are what keeps the miners honest. For anyone who verifies incoming transactions themselves using a complete node ("economically relevant complete node"), this ensures the validity of the chain. Minors have no way of deceiving them (except for a 51% attack, see below), and therefore they are not encouraged to produce blocks that break the rules, because such blocks will be dropped on the ground and ignored by the complete knots. . For those who do not perform a node themselves, it is useful to know that a sufficient number of independent parts run full nodes, as it is hoped that these parts are important enough for the miners do not want to waste their money by creating an invalid block that they would detect.
The security of Bitcoin is based on auditability and not on trust. You know that the chain, in its entirety, is valid because you can independently verify that this is the case.
Unfortunately, there is no way to check which of the two conflicting (but otherwise valid) transactions is the "real" transaction without a central clearing house that blesses one of them. This is what is called the problem of double spending, and that is why we need minors: a decentralized treatment center to which anyone with the right equipment, even anonymous way, can adhere. Producing blocks costs money for them, and they are paid only if the network of complete nodes accepts their blocks. This is why they are encouraged (but not forced) to produce blocks that respect the rules and build on each other.
But it is important to see that the 51% attack is the exception here. For almost all Bitcoin rules, complete nodes check everything, and there is no So, they can be fooled. The only thing that can not be independently verified is double the expenditure, which leads to a 51% attack if it is exploited (but the theory is that it would be expensive for the miners, so not economical; Moreover, if minors do not do their job well, others are encouraged to become minors themselves).