Enhancing Answer Selection in Community Question Answering with Pre-trained and Large Language Models