There are three passages in the book of Hebrews that are often collectively called the Warning Passages. Some people take them as hints that once we are genuinely and graciously saved by God through Jesus, we can turn around and mess up the salvation we were granted.
But that's not really what they're saying at all.
There are three: Hebrews 3.12-19, Hebrews 6.1-12, and Hebrews 10.26-31 (today's passage)
Most scholarly types think Hebrews is a sermon-turned-letter that circulated. So the warnings have to be taken as part of a sermon, something that you can imagine a pastor admonishing and warning his congregation with because he knows there are people out there who have not genuinely and graciously been saved by Christ. He didn't want them to be deceived into thinking they were spiritually okay when they were not.
Each of the passages has some "relief" at the end of it and points to the reality for those who have been saved.
The function of the warning, though, is to make people check themselves, to examine themselves, to continue the work of placing ongoing faith in Christ. It's not unlike when I warn my kids about doing something wrong in order for them to continue doing the right thing instead.
Hebrews, as a kind of running commentary on the first five books of the Bible, can be a little confusing at times. When I read today's passage I thought about those three passages and how they can throw some people off.
I hope that helps.