Second hand houses/flats do not come with a warranty, like a car might, so when buying one, it is down to you to make sure there are no costly repairs needed as soon as you move in. For example, roofs that need replacing, the building sinking into the ground, walls cracking, drains blocked.
Whilst new properties will inevitably have some sort of warranty, even then, a surveyor can still be used to determine how likely you are to have to make an imminent claim on them, if the standard of build is not great, a hassle you might prefer not to have.
You can discuss with the surveyor the property you are wanting to buy, and what type of survey is appropriate. There are typically two types: a Home Buyer survey, or a Building (often known as full structural). The latter is very detailed and typical for older more unusual property. But again your surveyor can advise.
Essentially you are inviting your surveyor to provide to you, a written report about the condition of the property in all aspects, so you, and only you, can decide if it is sound, or whether there are repairs needed, and if the latter, how much they might be in case you need to renegotiate a lower price before committing yourself further to the purchase. Or you just decide the work needed is too much and not a project/property you wish to continue to purchase.
The survey report is not for your lawyer, as they are not expert to comment, nor would it make much sense to them as they have never visited the property. Any legal section should ideally be covered when you receive your conveyancer's written report on all the legal posers they have received.
Surveys of flats are no less common, as whilst the flat will usually comprise the interior not the external walls, the surveyor can still comment on any necessary internal repairs, safety, and recent and or previously unnoticed alterations. However, they will also be able to survey the exterior and common parts, which will give you a idea how through the landlord is in repairing the building, and also giving you an idea of the forthcoming repairs which you as a tenant will probably in the lease be obliged to pay towards.