"Now these things occurred as examples to keep us from setting our hearts on evil things as they did. Do not be idolaters, as some of them were; as it is written: 'The people sat down to eat and drink and got up to indulge in pagan revelry.' We should not commit sexual immorality, as some of them did - and in one day twenty-three thousand of them died. We should not test the Lord, as some of them did - and were killed by snakes. And do not grumble, as some of them did - and were killed by the destroying angel." NIV translation
The Jews would have remembered these events from the history of their people. As Paul says, they were an example to God's people then as well as for us today. They remind us that our actions have consequences while we are here on this earth.
"These things happened to them as examples and were written down as warnings for us, on whom the fulfillment of the ages has come. So, if you think you are standing firm, be careful that you don't fall. " NIV translation
The phrase "if you think you are standing firm" speaks to the issue of pride which is usually at the root of sin.
Those who think that way do not see a reason to study God's word and to pray. This, in turn, leaves them open to effective attack by the enemy which is Satan. Pride caused his fall and it can cause us to stumble as well.
That is why Paul urged the Ephesians (and us as well) to put on the armor of God which includes the "belt of truth" (see Ephesians 6:14).
What does Paul mean by "be careful that you don't fall"? In chapter 9, Paul compared the Christian life to running a race with a trophy (reward) at the end of the race for the winner. Many times, there are prizes for different places and often everyone who finishes gets something. Many have used this passage to justify their concept of someone losing their salvation but that is not the prize that Paul is talking about.
There have been famous cases of runners who are in a race and they stumble and fall down because of another runner getting in their way and their feet getting tangled up. They usually get back up and finish the race but they do not get the trophy or medal. Likewise, the Christian who stumbles under the temptations of the devil (gets their feet tangled up) can get back up and continue with the race. They will still have some type of reward but they will have missed out on the greater reward that goes to the winner.