For example: form id = "xyz" after submit form id="xyz--2" on validation error page. please help me.
You are definitely using wrong variable to grab the form id. Otherwise it's not possible that main form id get changed. Please print your form array in hook_form and if you are using some existing form, then use hook_form_alter to print your form and check your form_id from there. Form ID is main identity of form so it can not be changed. but if you talk about css ID, then it can be changed. Please paste your form array here. I will be able to tell you appropriately then.
Thank You!!