If you've been a permanent resident with a green card since 1998 and just married a US citizen can you just change your last name when you file for citizenship or do you need to do it prior to that?

Yes you can change your name when applying for citizenship providing you have your marriage license.