Yes, you can get a longer term visa with your passport expiring earlier than the visa, there is no such restriction.
Documents you must provide
When you apply you’ll need to provide a current passport or other valid travel identification.
You need a page in your passport that’s blank on both sides for your visa. Your passport must be valid for the whole of your stay in the UK.
When your passport expires and you get a new one you will have to carry both passports when you go to the UK, or you can get a BRP (but this is not a compulsion).
If your passport has expired
You can still use the valid visa in your expired passport, but you’ll need to show your expired passport and your new passport when you’re travelling to and from the UK.
If you’re in the UK, you can apply for a BRP instead.
If you’re outside the UK, you can transfer your visa to your new passport.
When you reach the UK your then valid passport needs to remain valid throughout your stay in the UK.
Your passport or identity card will be checked when you arrive at a UK port or airport to make sure you’re allowed to come into the country. It must be valid for the whole of your stay.
Note: BRP is not applicable to standard visitor visas because they don't allow stays of longer than 6 months ordinarily but it is still an option for longer stay visas.