Synthesis, Characterization, and Antibacterial and Anti-Inflammatory Activities of New Pyrimidine and Thiophene Derivatives