Answer: The Beis Yosef (OC 489:1) writes that there is a machlokes as to whether one may count the sefira during bein hashemashos (the time between shekia, sunset, and nacht, nightfall). Tosafos (Menachos 66a), the Rosh (Pesachim 10:40) and Tur (OC 489:1) maintain that as counting is only miderabanan nowadays, one may count before nacht. The Ran (Pesachim 28a) and Rambam (Temidin U’musafin 7:22) however write that one should wait until nacht. Following this, the Mishna Berura (489:14) writes that ideally one should wait until nacht to count.
The Shulchan Aruch (OC 489:1) writes that one should count the sefira after maariv. The Mishna Berura (Biur Halacha 489:1) quotes R’ Yaakov Emden (Mor Uketzia 489:1) who explains that the reason we count after maariv is because people used to daven maariv before nacht. Accordingly, one davening maariv later would count the sefira first (See Shevet Halevi 6:53:3).
R’ Moshe Feinstein (Igros Moshe OC 4:99:1) however, writes that we follow R’ Yaakov Reischer (Chok Yaakov 489:16) who explains that the reason is because we follow the rule of tadir kodem, giving precedence to the more common mitzva. The only reason we count the sefira before reciting kiddush and havdala is because those must be done at home while it is ideal to count the sefira together with others in shul.
Likewise, the Shulchan Aruch Harav (OC 489:16) writes that while one may count as soon as it’s nacht, it is best to do so after maariv.
In conclusion, one should ideally daven maariv at nacht followed by the sefira.