You are asking two different questions. The first question (I'm going to rephrase it for clarity) is:
What will happen if I sell my house for less than the mortgage?
Answer: Let's say you owe $200,000 on your mortgage. Let's say that you sell it for only $175,000 because that's all it is worth. The difference is $25,000. Your mortgage lender will require that you pay back the entire $200,000 which is what you owe. You will have to give your mortgage lender the $175,000 from the sale of your home. You will also have to come up with another $25,000 (the difference) to pay off the mortgage in full. If you are able to pay the loan off in full ($175,000 + $25,000 = $200,000), then everything will be fine. The fact that you did it this way will have NO bearing on your ability to get another mortgage.
Your second question is: Will I be able to get another mortgage?
If you are unable to come up with the $25,000 "shortfall," your mortgage lender has the right to sue you for it. The fact that you did it this way WILL go on your credit report and you may find it difficult to get another mortgage.
Hope this helps.