Can I take a beta blocker as needed for palpitations? If so, which one is better? Metoprolol or bisoprolol?

Yes. If you're taking it just for palpitations, it is reasonable to take it only on an "as needed" basis. And either of those choices is fine; they are really quite equivalent.
This is done in. Select cases...Either is acceptable. Also keeping well hydrated, teducing stimulants and regular exercise can also be quite beneficial.