Details help with the answer.
If you are going to sell your existing home and use the money to purchase a second home, there is a 3 month home replacement exclusion period. So, selling your home in March 2013, the $40,000 would be excluded from the $2000 resource limit the date of the sale through June 30, 2013 IF you intended to and then actually spent the money on a new home. That includes the cost of moving and needed repairs to the new home. I would suggest opening a separate bank account for that money. This means no stopping of Medicaid or SSI during that three months. If you haven't bought a home by June 30, then you would be over the resource limit on 7/1 and ineligible until you did spend the money.
If you do not intend to buy a new home or change your mind about buying a new home, then the $40,000 becomes a resource the month after your existing home is sold and SSI and Medicaid would stop while you were over the $2000 resource limit.
There are other excluded resources you buy; a vehicle, burial spaces, separate burial funds up to $1500. Need to talk your local office.
https://secure.ssa.gov/apps10/poms.nsf/lnx/0501130110
Your Social Security and Medicare would not be affected by selling your house. You may have to pay your own Part B Medicare premiums if Medicaid stops.
As an SSI recipient, you can live with others and still qualify. You always have to pay your share of food and shelter bills. If there are four people in the house (any age) your share of the bills is 1/4 of the rent, gas, electricity, water, sewer, garbage and food. If you live with someone with high rent or high mortgage, your share is still 1/4. As long as you pay your share, you get the same SSI as if you live alone.
As long as your resources are under $2000.
So your plan can work. You just need to finalize it and stay in touch with your local office. Keep all documents, even after you have submitted them. SSA sometimes misplaces documents. I would again suggest a separate bank account for the money from the sale of the house. Just makes it all straightforward and easy to follow. Don't mingle your money with your daughter or anyone else. Too hard to follow.